在用jxl导出excel时,如何设置单元格的粗细

解决方案 »

  1.   


     //设置边框
                jxl.write.WritableCellFormat wcsB = new jxl.write.WritableCellFormat();
                wcsB.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THICK);
                labelCFC = new jxl.write.Label(0, 6, "边框设置", wcsB);
      

  2.   

    就直接把我做的JXL笔记复制点给你吧:WritableFont font3 = new WritableFont(WritableFont.createFont("宋体"),12,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE, Colour.RED );
    WritableCellFormat wcfF = new WritableCellFormat(font3); //通过它可以指定单元格的各种属性//添加边框:
    wcfF.setBorder(Border.ALL, BorderLineStyle.THIN);
    //添加背景色:
    wcfF.setBackground(Colour.GRAY_25);//把水平对齐方式指定为居中
    wcfF.setAlignment(Alignment.CENTRE); 
    //把垂直对齐方式指定为居中
    wcfF.setVerticalAlignment(VerticalAlignment.CENTRE);
    //设置自动换行
    wcfF.setWrap(true);
    Label labelCF = new Label(10, 0, "This is a Label cell", wcfF);
    你说的单元格的粗细:应该就是BorderLineStyle.THIN的具体值了,你在BorderLineStyle后面点下,看它还有什么其它的属性值,最好看下相关的帮助文档。
      

  3.   

    呵呵,谢谢各位,我当时设置了就是傻得没有往 lable里放。