Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Servlet excel zip is not generate correctly some excel file corrupted  RSS feed

 
chandana nalin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did excel file generate as zip with Apache POI..but some excel files are corrected. any idea??

 
Tim Moores
Saloon Keeper
Posts: 3511
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell what's going on since you posted only partial code. It looks odd that the code adds one line of cells to a spreadsheet, and then writes something to a file.
 
chandana nalin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
corrclty generate excel file with zip but problem is only file one can open others are corrupted but file sizes are shown.
 
Dave Tolls
Ranch Hand
Posts: 2504
27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your first step is to take that chunk of code out of the server and change the output stream to a target on your dev machine.

Indeed, you could even take out the Excel part and simply try and stream a String to a zipped file via a ByteArrayOutputStream (assuming that's the correct way to do this).

If that doesn't work then you've at least narrowed down where the issue is.

Once you've managed to get a String to save into a zipped file then you should be able to utilise that for streaming a zipped version of your Excel "file".
The big advantage of this is that it'll be a simple, short method and you can then post that here as something we could actually execute.
 
chandana nalin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Dave Tolls
Ranch Hand
Posts: 2504
27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that code that works now?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!