Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POI writes formula to Excel, but formula's value is not calculated

Status
Not open for further replies.

Ben3026

Programmer
Dec 11, 2008
4
US
I've written Java POI code to open an Excel file and set a cell's formula by using "setCellFormula()". The code compiles and correctly updates the field's formula, but the value is not calculated. For example, a cell's value might be set to "=2+2" by calling
cell.setCellFormula("2+2");
and the string gets inserted into the cell.
It only calculates the value "4" if I open the excel spreadsheet, click into the cell, and press the Enter-key... only then does it show the calculated value.

How can I cause the cell to compute the value without my having to open and interact with the file? Is there a refresh() or maybe update() or compute() that I should use?

Thank in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top