I am using Jakarta POI to write to excel using servlets. I am using a formula to calculate the sum: cell1.setCellFormula("SUM(A1:A2)"). But I am getting this error: Method setCellFormula(String) not found. I am also importing this package: org.apache.poi.hssf.usermodel.HSSFCell. Could you please tell me where I might be going wrong.
Thanks.
Padma Lalwani
Ranch Hand
Joined: Nov 02, 2004
Posts: 49
posted
0
One of the reasons might be an older version of POI. Formula support started with version 2.0 I use poi-2.5.1-final-20040804.jar and it works fine
ford Darcy Jr
Ranch Hand
Joined: Jan 26, 2005
Posts: 76
posted
0
Thanks for the reply. I am using the same Jar file: poi-2.5.1-final-20040804.jar
Is there any other reason why its not working. I mean do I need to import any other package for this ?
Thanks.
Jeffrey Spaulding
Ranch Hand
Joined: Jan 15, 2004
Posts: 149
posted
0
You might stick to the error message. Maybe cell1 simply isn't the right Object. How do you instantiate cell1 and how do you declare cell1?
J.
ford Darcy Jr
Ranch Hand
Joined: Jan 26, 2005
Posts: 76
posted
0
Originally posted by Jeffrey Spaulding: You might stick to the error message. Maybe cell1 simply isn't the right Object. How do you instantiate cell1 and how do you declare cell1?
J.
Hi,
This is how I am declaring it. Please help...as I am struck with this error. HSSFCell cell1 = row5.createCell((short)4); cell1.setCellType(HSSFCell.CELL_TYPE_FORMULA); cell1.setCellFormula("SUM(A1:A2)"); Thanks,