• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

file Writing problem

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone,

i am working with Excel workbook using apache POI API.After writing the data into the workbook the size of the file is reducing and the file is getting corrupted it has shown an error like:

"Excel Found Unreadable Content in FILENAME.xlsx. do you want to recover the content of this workbook?If you trust the source of this workbook click yes! "

i am attaching my code



please help me in finding the error..!!!
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you are trying to add content to an existing work book. Which version of excel was this sheet created in.
Try creating a new workbook as described in http://poi.apache.org/spreadsheet/quick-guide.html#CreateCells and see if you can reproduce the issue.
 
Ravikanth thota
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sudhir Ravindra wrote:Looks like you are trying to add content to an existing work book. Which version of excel was this sheet created in.
Try creating a new workbook as described in http://poi.apache.org/spreadsheet/quick-guide.html#CreateCells and see if you can reproduce the issue.



i am using Microsoft 2010 excel. my code is working fine with .xls files(till Microsoft 2007). but for .xlsx files, after writing into excel, if we try to open excel it is showing error as i mentioned above..
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, were you able to solve this issue?

I am having the same problem when I try to create an Excel sheet using Apache POI.
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if this will help but I've always used the WorkBookFactory to create the WorkBook ie:

If this doesn't help can you show the code you are using.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic