java - Apache POI Not Recaclulating -


i have workbook large number of formulas, including formulas depend on results of other formulas depend on vlookups, etc. of these lead calculation of single value. when try value via poi 3.13, it's #value!. however, if open workbook in excel, it's calculated correctly.

before getting value need, call:

book.getcreationhelper().createformulaevaluator().evaluateall(); 

which, according documentation, should resolve these issues. apache's documentation calls out #value! issue , suggests above step resolution, yet can't work. not formula exceptions.

i've tried calling evaluateall() after each time set value (about 100 set scenario), still it's #value!

    public boolean setvalue(final int value, final string tabname, final int rownum, final int colnum) {     boolean returnval;     try {         final cell currentcell = getcell(tabname, rownum, colnum);         currentcell.setcellvalue(value);         currentcell.setcelltype(cell.cell_type_numeric);         book.getcreationhelper().createformulaevaluator().evaluateall();         returnval = true;     } catch (final exception e) {         logger.error("exception setting value " + value + " on " + tabname + " " + rownum + "," + colnum, e);         returnval = false;     }     return returnval; } 

the cell in question has formula:

=sum('veh1'!h3+'veh2'!h3+'veh3'!h3+'veh4'!h3) 

all of cells, 'veh1'!h3, have similar formulas deal specific sheet:

=if('veh1'!b10>0,sum(h11:w11),0) 

where value in 'veh1'!b10 1 through 4. h11 through w11 formula cells, such as:

=h71+h40 

h71 this:

=round(h69*h39,2) 

and on down chain of dollar values multipled times factor value. factor values found via lookups:

=if(iserror(vlookup($c26,lookuptable,3,false)),1,vlookup($c26,lookuptable,3,false)) 

where lookuptable in above named sub table on worksheet. lookups based on values of either a) user (or poi, in case) entered in cell, or b) combination of several cells poi entered, =b1&b2&b3&b4

each of steps repeated dozens of times. basically, sum of 16 values each of 16 sum of 52 rows, half of lookups (many various if conditional logic pieces well), other half pretty simple =round(a1*b1,2) formulas.

it appears last step fails, formula:

=sum('veh1'!h3+'veh2'!h3+'veh3'!h3+'veh4'!h3) 


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -