读书人

JXL应用日记

发布时间: 2012-11-23 22:54:33 作者: rapoo

JXL使用日记

//创建File文件对象file=new File(generateFileName);//创建一个Excel文件工作对象ExcelStore es = new ExcelStore();//把file对象连接到Excel对象ExcelConnection  ec = es.openConnection(file);//Excel工作表对象ExcelCollection collection=ec.createDataCollection(sheetName,i,keys,maps); //创建文档集sheetWritableSheet sheet = workbook.createSheet(sheetName,sheetNo);//设置报表每列的长度sheet.setColumnView(col, 40);     //设置字体格式WritableFont fontFormat  = new WritableFont(WritableFont.createFont("宋体"),11);//设置单元格格式      WritableCellFormat fontContentFormat =new WritableCellFormat(fontFormat); //设置边框fontContentFormat.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); //设置背景色fontContentFormat.setBackground(Colour.WHITE);//定义单元格Label label=new Label(col,row,ckMap.getKey(),times10BoldFormat);//把单元格添加到sheetsheet.addCell(label);

?

读书人网 >编程

热点推荐