File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Excel file is corrupted when i download it

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i have generated excel file using Apache POI .it is generated in my root path under excel folder.when user click save as excel the created file should download to user chosen location. it is get downloaded to that perticular path given by user but, when i try to open a message is showing like this file format corrupted ......my code on click of button on jsp is

but the generated code is giving a corrupted excel file
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is working when i deployed it on web not in local system why?
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't use JSP files to display any binary file, including Excel files. Any whitespace between tags (like at the top, between import directives) can already be added to the output. That will cause corruption of binary files. Instead, use a servlet to display the binary file.
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic