Bug 60036 - SXSSFSheet.autoSizeColumn is throwing IllegalStateException
Summary: SXSSFSheet.autoSizeColumn is throwing IllegalStateException
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-24 07:19 UTC by Ranjay Mishra
Modified: 2016-08-24 07:40 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ranjay Mishra 2016-08-24 07:19:26 UTC
Hi,

I am using POI-3.14 for creating xlsm file. while calling  sheet.autoSizeColumn I am getting below exception. It used to work with earlier version. This issue has blocked our one of the critical functionality. Can you please look into it or it is already fixed in later release Please let us know.

Exception 
-----------
Caused by: java.lang.IllegalStateException: Could not auto-size column. Make sure the column was tracked prior to auto-sizing the column.
	at org.apache.poi.xssf.streaming.SXSSFSheet.autoSizeColumn(SXSSFSheet.java:1560)
	at org.apache.poi.xssf.streaming.SXSSFSheet.autoSizeColumn(SXSSFSheet.java:1514)
Comment 1 Nick Burch 2016-08-24 07:20:53 UTC
The exception tells you what you need to do to avoid it - what happens when you do what it indicates?
Comment 2 Ranjay Mishra 2016-08-24 07:28:34 UTC
Thanks for you quick response!

What does it mean by  "tracked prior to auto-sizing the column"?
Do we need to call any API on sheet prior to calling  sheet.autoSizeColumn ?
Comment 3 Nick Burch 2016-08-24 07:40:16 UTC
The explanation and fix is explained in the SXSSF javadocs for the method you're using: https://poi.apache.org/apidocs/org/apache/poi/xssf/streaming/SXSSFSheet.html#autoSizeColumn(int)