public static void main(String[] args) throws IOException, WriteException{
jxl.write.WritableWorkbook ww = Workbook.createWorkbook(new File("M:\\workspace\\wxzb\\src\\images\\tes.xls"));
WritableSheet ws = ww.createSheet("工作簿", 0);
WritableCellFormat wcf = new WritableCellFormat();
CellView cv = new CellView();
//cv.setAutosize(true);
//cv.setSize(40*256);
ws.setColumnView(0, cv);
Label l = new Label(0,1,"这是测试内容。。。。。。。。。");
ws.addCell(l);
ww.write();
ww.close();
}
运行上面的方法,excel里面是没有内容的!如果将cellview注册到Sheet中,则必须调用cellview的setAutoSize(true)
或者setSize(int size)方法。同时调用时按setAutoSize(true)执行!
时间: 2024-11-10 07:37:33