Could you please zip and attach your sample Excel file and share your sample (runnable) code to reproduce the issue on our end, we will check it soon.
abxc - Copy.zip (2.5 MB)
AsposeLightCellsExtractor.zip (1.1 KB)
@amjad.sahi, Please find the sample code and the test file attached here (Please note that I have performed the test on an xlsx file by converting the attached xlsb file to xlsx file using Office365 application).
Thanks
Ravi
I checked your file and there are lots of unnecessary blank ranges of cells. Anyways, I did test your code segment with template Excel file and it consumes 1GB or more memory for the process. When I opened your file into MS Excel, it takes time to open the file into it. Anyways, to save more memory, you may try to set MemoryPreference option on, see and try the updated code segment, this will work better.
e.g.
Sample code:
private LoadOptions getLoadOptions(long outputStringSize, ExcelCellsDataHandler extractor) {
final LoadOptions loadOptions = new LoadOptions();
loadOptions.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);
loadOptions.getLoadFilter().setLoadDataFilterOptions(LoadDataFilterOptions.CELL_DATA);
loadOptions.setLightCellsDataHandler(extractor);
return loadOptions;
}
Let us know if using the suggested option makes any difference?
Thanks @amjad.sahi. I see a good improvement in the overall memory consumption after this enabling this flag (of course, it is coming with a cost of some relatively less performance in terms of speed).
Will try to explore more and reach out to you if I have any other questions.
Thanks
Ravi