Auto size height for rows in Apache POI

后端 未结 10 995
闹比i
闹比i 2020-12-08 18:47

I am inputting values into a spreadsheet using Apache POI. These values have newlines, and I was able to use this code successfully:

CellStyle style = cell.g         


        
10条回答
  •  遥遥无期
    2020-12-08 19:43

    HSSFWorkbook workbook=new HSSFWorkbook();
    HSSFSheet sheet =  workbook.createSheet("FirstSheet");  
    HSSFRow rowhead=   sheet.createRow((short)0);
    HSSFCellStyle style = workbook.createCellStyle();
    style.setWrapText(true);
    row.setRowStyle(style);
    row.getCell(0).setCellStyle(style);
    

    The above code will generate dynamic height of rows.

提交回复
热议问题