首页 > 其他 > 详细

POI生成Excel强制换行

时间:2015-08-19 10:44:14      阅读:252      评论:0      收藏:0      [点我收藏+]

自动换行的设置: 

HSSFCellStyle cellStyle=workbook.createCellStyle();         
cellStyle.setWrapText(true);         
cell.setCellStyle(cellStyle);   

强制换行:

<pre name="code" class="html">HSSFCell cell = row.createCell((short)0);      
cell.setCellStyle(cellStyle);                            
cell.setCellValue(new HSSFRichTextString("hello/r/n world!"));   

修改代码如码如下

HSSFCell cell = row.createCell((short)0);     
cellStyle.setWrapText(true);//先设置为自动换行     
cell.setCellStyle(cellStyle);                            
cell.setCellValue(new HSSFRichTextString("hello/r/n world!"));   

POI生成Excel强制换行

原文:http://www.cnblogs.com/dtts/p/4741382.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!