Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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

 
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: 5802
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • 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: 4258
47
  • 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: 4258
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that code that works now?
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!