用jxl可以很方便的生成excel文件,下面記錄使用中的一些方法:
1、對文本格式化:
WritableFont wf = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE); //粗體10號字
WritableCellFormat wcf = new WritableCellFormat(wf);
wcf.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); //設置邊框
2、數字格式化:
jxl.write.NumberFormat nf = new jxl.write.NumberFormat("#.##"); //小數位如果為0不顯示
jxl.write.NumberFormat nf = new jxl.write.NumberFormat("#.00"); //小數位不足用0補齊
Technorati : excel, jxl
posted on 2009-01-16 16:38
Libo 閱讀(1092)
評論(0) 編輯 收藏