Skip to content

Cell formulas

firegloves edited this page Jul 20, 2022 · 1 revision

Cell formulas

You can specify subfooter's cell formulas by applying a bundled subfooter or creating a custom one. By default MemPOI attempts to postpone formulas evaluation by forcing Excel to evaluate them when it opens the report file. This approach could fail if you use LibreOffice or something similar to open your report file (it could not evaluate formulas opening the document). So by setting MempoiBuilder.evaluateCellFormulas to true you can avoid this behaviour forcing MemPOI to evaluate cell formulas by itself.

But depending on which type of Workbook you are using you could encounter problems by following this way. For example if you use an SXSSFWorkbook and your report is huge, some of your data rows maybe serialized and when MemPOI will try to evaluate cell formulas it will fail. For this reason MemPOI tries to firstly save the report to a temporary file, then reopening it without using SXSSFWorkbook, applying cell formulas and continuing with the normal process.

Also this approach may fail because of that not using a SXSSFWorkbook will create a lot of memory problems if the dataset is huger than what the memory heap can support. To solve this issue you could extend your JVM heap memory with the option -Xmx2048m

So actually the best solution for huge dataset is to force Excel to evaluate cell formulas when the report is open.

Clone this wiki locally