Avoid exception The maximum length of cell contents (text) is 32,767 characters

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Avoid exception The maximum length of cell contents (text) is 32,767 characters

maitrey
We were using poi-3.11 jar in our older version of application. Now in newer
version we have upgrade the new poi version to 3.16.
Everything is working fine but we found one issue of cell characters length.
Some of our client are using libre office(LibreOffice is a free and open
source office suite).
In poi-3.12 one fix introduce
(https://bz.apache.org/bugzilla/show_bug.cgi?id=56579).
[Throw exception if max string length of 32767 chars is exceeded in XSSF and
SXSSF.]
In libre office there is no limit of cell characters and contains more than
32767 characters in a single cell.
When we try to export the excel, it throws exception.

java.lang.IllegalArgumentException: The maximum length of cell contents
(text) is 32,767 characters
        at org.apache.poi.xssf.streaming.SXSSFCell.setCellValue(SXSSFCell.java:338)
        at
com.os.util.StaxParserBaseExportHelper.validateOtherCellPattern(StaxParserBaseExportHelper.java:895)
        at
com.os.util.StaxParserBaseExportHelper.createCell(StaxParserBaseExportHelper.java:841)
        at
com.os.util.StaxParserBaseExportHelper.createCellInSheet(StaxParserBaseExportHelper.java:678)
        at
com.os.util.StaxParserBaseExportHelper.checkXmlStreamReaderForRow(StaxParserBaseExportHelper.java:488)
        at
com.os.util.StaxParserBaseExportHelper.eventTypeEndElement(StaxParserBaseExportHelper.java:440)
        at
com.os.util.StaxParserBaseExportHelper.exportToExcel(StaxParserBaseExportHelper.java:196)
        at
com.os.util.helper.griffin.GriffinCommonHelper.createXLSFile(GriffinCommonHelper.java:2224)
        at
com.os.util.helper.griffin.GriffinCommonHelper.createXLSFileFromFile(GriffinCommonHelper.java:2193)
        at
com.os.gfnactions.isheet.SheetContentManagerUserViewAction.exportItemGridAsXLS(SheetContentManagerUserViewAction.java:2746)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)
        at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
        at
com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96)
        at
com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88)
        at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1620)
        at ognl.ASTMethod.getValueBody(ASTMethod.java:91)
        at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
        at ognl.SimpleNode.getValue(SimpleNode.java:258)
        at ognl.Ognl.getValue(Ognl.java:470)
        at ognl.Ognl.getValue(Ognl.java:434)
        at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:371)
        at
com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:423)
        at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:369)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:436)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
        at com.os.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:107)
        at java.lang.Thread.run(Thread.java:748)

Is there any solution or any way to use backward compatibility?



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Avoid exception The maximum length of cell contents (text) is 32,767 characters

pj.fanning
https://support.office.com/en-us/article/Excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3#ID0EBABAAA=2016,_2013
- 32,767 is the limit in Excel.

To support LibreOffice as a special case and apply different limits is
feasible but non-trivial.
Could you raise a bugzilla issue to track this?

Options include:
* Introduce a flag that turns off the limit checks
* Revisit SpreadsheetVersion enum to allow users to supply their own
implementation with different limits.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Avoid exception The maximum length of cell contents (text) is 32,767 characters

pj.fanning
If you're stuck, you could subclass SXSSFCell in your application and have
the logic in your subclass skip the cell size check.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]