You can't do that with POI. If the cell contains a formula, you can only get the formula out.
You must let Excel do the calculation. Excel does this automatically when the spreadsheet is opened. That's why opening and saving with Excel, then looking at the cell with POI yields the correct result. The idea here is that if you build a spreadsheet, you know what numbers you put into C1 and C2, and can easily add them in your program. Or, if you are processing an uploaded spreadsheet, you can read the values of C1 and C2, then add them in your program. POI does not, and perhaps never will, interpret or execute the formulas you put into the spreadsheet. -----Original Message----- From: Suma G Shanthappa [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 4:16 AM To: POI Users List Subject: How to get the value of a formula cell? I have a sheet with formula for cell C3. formula is sum(c1:c2) I insert values to c1 and c2. If I try to get the value of C3 I get 0.0 How do I get the value of c3 cell? Even if i save all the data and then try to open the file and try reading the value of c3 cell I get 0.0 But if I do save as and save the file with a diff name and try to read the value of c3 cell, I get the correct value? Any Idea how to retrieve the value of a formula cell from the same file to which the data is stored to? Thanks Suma --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
