poi的几个使用小技巧

poi是用来操作Execl比较方便的开源的包,里面的功能也比较多,我这里总结几个比较常用的但是往往容易被忽视的几个用法.

 

1. 单元格中,设置自动换行:

HSSFCellStyle cellStyle = workbook.createCellStyle();

cellStyle.setWrapText(true);

2.设置单元格的行宽:

( HSSFSheet sheet )

sheet.setColumnWidth((short)y, (short)(15*256));//半角15个字 

 

3.设置单元格的行高:

sheet.getRow(x).setHeight((short)(3*256));

 

posted @ 2007-08-28 16:20  竹君子  阅读(195)  评论(0编辑  收藏  举报