I have a tax program (rpg) that's populating an excel spreadsheet, multiple sheets. I'm using the hssfr4 service program to do this.
I'd like the entire workbook to recalculate when the user opens it.
I've scammed thru the poi documentation and figure that setForceFormulaRecalculation is what I'm looking for to have the spreadsheet auto recalculate the next time it is opened.
I don't see that setForceFormulaRecalculation is 'wrapped' in the hssfr4 service program anywhere.
I'm taking a stab at doing it myself (sigh), looking at examples, trial and error but to sum up, I'm feeling pretty stupid! (again)
I came up with this this morning - Oddly it calls for a Boolean value but won't let me use that as a parm.
When I added (work)book as a parm and commented out TorF, then it compiled fine.
d forceRecalc pr
d extproc(*JAVA
d :'org.apache.poi.hssf.usermodel-
d .HSSFWorkbook'
d :'setForceFormulaRecalculation')
d book like(SSWorkbook) const
d**TorF like(jBoolean) value
Has anyone used the set force formula recalculation in RPG?
Can anyone share the correct way to use RPG to prototype and use set force formula recalculation?
Any help is greatly appreciated, thanks.
John
http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Workbook.html#setForceFormulaRecalculation%28boolean%29
setForceFormulaRecalculation
void setForceFormulaRecalculation(boolean value)
Whether the application shall perform a full recalculation when the workbook is opened.
Typically you want to force formula recalculation when you modify cell formulas or values of a workbook previously created by Excel. When set to true, this flag will tell Excel that it needs to recalculate all formulas in the workbook the next time the file is opened.
Note, that recalculation updates cached formula results and, thus, modifies the workbook. Depending on the version, Excel may prompt you with "Do you want to save the changes in filename?" on close.
Parameters:
value - true if the application will perform a full recalculation of workbook values when the workbook is opened
Since:
3.8
As an Amazon Associate we earn from qualifying purchases.