This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes xlxs extention does not support Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "xlxs extention does not support" Watch "xlxs extention does not support" New topic
Author

xlxs extention does not support

Bhupendra Dubey
Greenhorn

Joined: May 10, 2011
Posts: 6
Hi,
Please help me...
I am using office 2007 and with xlxs format
The list which is being displyed on page ..I am trying to save it In Excel wih POI.
Servlet code is saving the data in excel to the destination in xlxs format
but In jsp when i try to open it directly in excel sheet after clicking on open button. It is giving message,

Excel cannot open the file DistributionCalendarDownload.xlxs because the file format and file extention is not valid.
Varify that the file has not been currupted and that the file extention matches the format of the File.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41046
    
  43
So... did you verify that the file is not corrupted? Did you make sure that the extension matches the file type?


Ping & DNS - my free Android networking tools app
Bhupendra Dubey
Greenhorn

Joined: May 10, 2011
Posts: 6
Yes file is not currupted and extention is valid
but excel is opening with .xls format but not in .xlsx format
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-disposition", "attachment;filename=ABC.xlsx");

when i am changing .xlxs in jsp in setContent Type it is giving the below message


Excel cannot open the file ABC.xlsx because the file format and file extention is not valid.
Varify that the file has not been currupted and that the file extention matches the format of the File
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41046
    
  43
How have you verified that the file is not corrupt? Also, you can't handle binary data in JSPs; you'll need to use a servlet instead.
Bhupendra Dubey
Greenhorn

Joined: May 10, 2011
Posts: 6
But If I open it from the destination path which i gave in servlet, It is open and show the data.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41046
    
  43
What you need to verify is that the data that gets stream from the web app is byte-for-byte identical to the file that you originally put on the server. Unless that's the case, all other speculation is pointless.
Bhupendra Dubey
Greenhorn

Joined: May 10, 2011
Posts: 6
Still not solving the problem
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41046
    
  43
Does that mean you have by now verified that what you stream from your servlet to the browser (and, as I said, you must use a servlet, you can't use a JSP) is a byte-for-byte identical copy of the original file? How did you do that?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: xlxs extention does not support
 
Similar Threads
Problem Opening File with .TIF Extension
Streaming an xcel file using servlets
Display image in jsp
Excel - IOException Invalid Header signature
sql to excel with java character problem.