You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SXSSFWorkbook is the Streaming version of XSSFWorkbook, It allows to write very large files without running out of memory as only a configurable portion of the rows are kept in memory at any one time.
This feature is quite relevant to Android where memory is not abundant. https://poi.apache.org/apidocs/dev/org/apache/poi/xssf/streaming/SXSSFWorkbook.html
stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.dstadler.poiandroidtest.poitest, PID: 20594
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/font/FontRenderContext;
at org.apache.poi.ss.util.SheetUtil.<clinit>(SheetUtil.java:111)
at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:271)
at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:82)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:658)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:679)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:90)
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.writeWorkbook(DocumentListActivity.java:183)
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:72)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
the issue can be easily replicated by modifying the method writeWorkbook() in DocumentListActivity.java of the piotest module. to the following:
The text was updated successfully, but these errors were encountered:
jacky-1
changed the title
Crash when using SXSSFWorkbook:
Crash when using SXSSFWorkbook: ava.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/font/FontRenderContext;
Apr 10, 2021
Android does not provide the java.awt.* packages and also actively refuses if you try to add such classes, this means any part of Apache POI which uses java.awt.* stuff will currently fail this way.
But as the implementation just provides dummy implementations of the methods, I did not merge it into master. The resulting autosized column widths are far off and will not be useful unless a more sophisticated solution is implemented.
If you just want to get SXSSFWorkbook to work should be able to fetch these changes from there in your fork.
It can also serve as example of how to add a more useful implementation in the future.
The same issue is triggered by calling Sheet.autoSizeColumn(Int row), this also needs the FontRenderContext.
Thanks for adding the example of how to add implementations for missing classes!
SXSSFWorkbook is the Streaming version of XSSFWorkbook, It allows to write very large files without running out of memory as only a configurable portion of the rows are kept in memory at any one time.
This feature is quite relevant to Android where memory is not abundant.
https://poi.apache.org/apidocs/dev/org/apache/poi/xssf/streaming/SXSSFWorkbook.html
stack trace:
the issue can be easily replicated by modifying the method writeWorkbook() in DocumentListActivity.java of the piotest module. to the following:
The text was updated successfully, but these errors were encountered: