• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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??

 
Saloon Keeper
Posts: 4487
112
  • 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.
 
Rancher
Posts: 3497
39
  • 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
Rancher
Posts: 3497
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that code that works now?
 
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!