hutool BigExcelWriter 下的autoSizeColumnAll异常问题

Posted singworld

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hutool BigExcelWriter 下的autoSizeColumnAll异常问题相关的知识,希望对你有一定的参考价值。

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();

以上是关于hutool BigExcelWriter 下的autoSizeColumnAll异常问题的主要内容,如果未能解决你的问题,请参考以下文章