JXL施用日记
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);