java - Apache POI initial calculation of formula after download -


i use apache poi creating excel file. there 2 diffrent sheets. sheet 1 template formulars. in sheet 2 want the value of 1 cell in sheet 1. excel-formula value sheet 1:

=if(sheet1!d7="";"";sheet1!d7) 

but when put text in d7 with

  cell = worksheet1.getrow(6).getcell(3);   cell.setcellvalue("sometext"); 

it wont take on value sheet 2. if click d7 , use enter, sheet2 take value, want, apache poi this.

how can handle this?

you have evaluate formula before final output.

use in order evaluate formulas.

formulaevaluator formulaevaluator = workbook.getcreationhelper().createformulaevaluator(); formulaevaluator.evaluateall(); 

use in order evaluate formula of specific cell

formulaevaluator evaluator = wb.getcreationhelper().createformulaevaluator(); evaluator.evaluateformulacell(cell); 

and write file in stream


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -