java POI实现Excel单元格数据换行

Workbook wb = new XSSFWorkbook();   //or new HSSFWorkbook();  
   Sheet sheet = wb.createSheet();  
  
   Row row = sheet.createRow(2);  
   Cell cell = row.createCell(2);  
   cell.setCellValue("Use \n with word wrap on to create a new line");  
  

   CellStyle cs = wb.createCellStyle();  
   cs.setWrapText(true);  //关键
   cell.setCellStyle(cs);  //单元格应用设置的style 
上一篇:Java 操作excel 插入删除列,插入删除图片


下一篇:excel转pdf