Currently I am using Apache POI for java to set formulas for cells, but the problem is after I run the program, and open the excel file that i created and processed with my java program, the cells with the formula included the formula as a string, rather than the value the formula should have returned.
+1
A:
The HSSFCell
object has methods .setCellType
and .setCellFormula
which you need to call like this:
// "cell" object previously created or looked up
String StrFormula = "SUM(\"A1:A10\")";
cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
cell.setCellFormula(strFormula);
Ninefingers
2010-02-26 03:07:39
let me try that real quick.
vamsi
2010-02-26 03:40:15
Nope that didn't work. Basically im using a custom formula that is not by default supported by excel. Would there be any problems with user defined formulas?
vamsi
2010-02-26 03:43:31
I wouldn't have thought so, but then I've never tried it. I see no reason why not; it should just fill the cell with =strFormula but perhaps it does something else.
Ninefingers
2010-02-26 03:55:27
A:
I am also unable to put my custom formulas. Can any one have the solution for this?
Vikas
2010-04-26 14:28:39