Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing excel through java

 
supriya lal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a bad idea:

catch(Exception e){}

How will you what problems there are?
 
supriya lal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou Mark it worked
 
supriya lal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes I never use catch(Exception e)... It was for the example..thankyou
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic