- autoSizeColumnAll
- java.lang.IllegalStateException: Could not auto-size column. Make sure the column was tracked prior to auto-sizing the column.
- SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
- // 上面需要强转 SXSSFSheet 不然没有 trackAllColumnsForAutoSizing 方法
- sheet.trackAllColumnsForAutoSizing();
- // 列宽自适应
- writer.autoSizeColumnAll();
来源: http://www.bubuko.com/infodetail-3330050.html