随笔-112  评论-73  文章-0  trackbacks-0

用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 : ,

posted on 2009-01-16 16:38 Libo 阅读(1084) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: