aspose file tools
The moose likes Other Open Source Projects and the fly likes Jakarta POI Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "Jakarta POI" Watch "Jakarta POI" New topic
Author

Jakarta POI

ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

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
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
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
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
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,
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
I am able to calculate the sum now. Thanks a lot.
 
 
subject: Jakarta POI
 
Threads others viewed
Jakarta POI
xml to ms word
Create rtf document based on a template
how to set coloumn width in excel sheet?
Saving data to Excel files
MyEclipse, The Clear Choice