wood burning stoves 2.0*
The moose likes Java in General and the fly likes writing excel through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "writing excel through java" Watch "writing excel through java" New topic

writing excel through java

supriya lal

Joined: Sep 11, 2012
Posts: 15
hello... I am trying to read an excel file hello and add new cells in the end an then add data to it and save it.. but my following programme is not producing any output.please help
Mark Beardsley
Ranch Hand

Joined: Jun 07, 2013
Posts: 32
My first observation is that you are using the wrong set of classes to handle the workbook. Excel workbooks come in two different formats; the older binary file format (.xls) and the newer OOXML format (.xlsx). From the code you posted, you would appear to be working with one of the newer format files - from the file extension .xlsx - and to do this with POI, you need to use the XSSF classes not the HSSF ones. Better still would be to use the classes in the unifying ss usermodel stream.

There are numerous examples on the POI website, http://poi.apache.org/spreadsheet/quick-guide.html
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41068
This is a bad idea:

catch(Exception e){}

How will you what problems there are?

Ping & DNS - my free Android networking tools app
supriya lal

Joined: Sep 11, 2012
Posts: 15
Thankyou Mark it worked
supriya lal

Joined: Sep 11, 2012
Posts: 15
yes I never use catch(Exception e)... It was for the example..thankyou
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: writing excel through java
Similar Threads
Save File on Client Machine
opening the excel sheet from servlet
setShrinkToFit using POI
facing diffculty to highlight background color of an excel cell which is not reflected in file
How to make POI HSSF support Chinese Encoding?