INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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.

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

Maybe this helps.

Cheers,
Dian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close