As Adrián mentioned, 255 characters is an Excel format limitation that POI adheres to.
Did you get this exception from calling setCellWidth or autoSizeColumn? The former should raise an exception, but the latter should probably quietly clip the auto-sized column width to 255 characters if best fit width is wider. Please open a bug at bz.apache.org/bugzilla iff autoSizeColumn throws an illegal value error if best-fit-width exceeds 255 characters. On Mar 29, 2016 6:08 AM, "Adrián Schwartzkopf" < schwartzkopf.adr...@gmail.com> wrote: > Hello, > > I already found an answer in the Documentation: > > > https://support.office.com/en-us/article/Excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa > > and > > * > https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFSheet.html#setColumnWidth(int,%20int) > < > https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFSheet.html#setColumnWidth(int,%20int) > >* > > Thank you and have a nice day. > > Br, > Adrian > > > Adrián Schwartzkopf <schwartzkopf.adr...@gmail.com> ezt írta (időpont: > 2016. márc. 29., K, 15:29): > > > > > Hello, > > > > I actually use Apache POI 3.14 to generate an *SXSSFWorkbook* with > > *SXSSFSheet*. > > I use the sheet.*trackAllColumnsForAutoSizing();* option and the > > *workbook.write(out);* method to write the XLS to an outpustream, but I > > become the following Exception: > > > > > > *Caused by: java.lang.IllegalArgumentException: The maximum column width > for an individual cell is 255 characters. > > at > org.apache.poi.xssf.usermodel.XSSFSheet.setColumnWidth(XSSFSheet.java:2386) > > at > org.apache.poi.xssf.streaming.SXSSFSheet.setColumnWidth(SXSSFSheet.java:274)* > > > > > > > > As I understand there was a Bug by the HssfSheet regarding this in the > older versions of POI, but it should be fixed: > http://apache-poi.1045710.n5.nabble.com/autoSizeColumn-setColumnWidth-passed-255-td4759807.html > > > > > > Have you an idea how can I fix this? > > > > > > Thank you. > > > > > > Br, > > > > Adrian > > > > > > > > >