Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

JSP to Excel, Content-Type: Application/vnd.ms-excel won't work with Excel2003

Posted on 2005-03-01
3
Medium Priority
?
3,620 Views
Last Modified: 2008-01-09
Hello Experts,

We have an JSP page that export the data to Excel by setting the response (ie Content-Type: Application/vnd.ms-excel). It works fine with Excel 97, but when we upgrade to Excel2003, the document is downloaded and opened fine. However when I want to save as, it thinks it is a HTML document and tries to save it as an web page document. I understand that from there I can change the file type to .xls and it will work fine. This extra step is very annoying and I am wondering if Excel still think it is a HTML document since it is downloaded from an jsp. We want to be able to save the document as an true excel document.

Thanks

Stephen
0
Comment
Question by:autoknowledge
1 Comment
 
LVL 1

Accepted Solution

by:
zania22 earned 800 total points
ID: 13442514
Try using Apache's POI  project that gives an API to create and read excel files. you could put the logic in your .jsp file, use a servlet or or bean

http://jakarta.apache.org/poi/hssf/index.html

its stable and works well. Its pretty much like:

(pseudocode)

//create file

worksheet worksheet  = new workbook()
sheet sheet = workbook.createSheet()
row row = sheet.createRow();
cell cell = cell.createCell();

for example, encapsulated very nice really easy to use

here is the api documentation as well:
C:\j2sdk1.4.2_05\POI\docs\apidocs\index.html

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Herein one will find an aggregate of some of my experience building and deploying virtualization stacks both in standalone, clustered Hyper-V, clustered Hyper-V with a Scale-Out File Server (SOFS) backend, and Storage Spaces Direct (S2D).
Ready to kick start your career in 2018? Add app developer skills to your resume. January’s Course of the Month features Android App Development training with hands-on learning.  Read on to learn why these skills are important.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question