1

I had a problem at work which I solved, but that raised me another question.
I wanted to export a page to excel, so I used this:

response.setContentType("application/vnd.ms-excel;charset=iso-8859-7");

It worked but while I was searching for an answer I found 3 possible content types for the excel:

> application/vnd.ms-excel
> application/x-msexcel
> application/ms-excel

As well as this: http://stason.org/TULARC/business/spreadsheets/10-19-What-is-the-correct-registered-MIME-Content-Type-for.html

What is the correct, registered MIME Content-Type for Excel files?

application/vnd.ms-excel

see http://www.isi.edu/in-notes/iana/assignments/media-types/application/vnd.ms-excel

so don't use any of these:
application/ms-excel
application/msexcel
application/excel
application/x-ms-excel
application/x-msexcel
application/x-excel
application/octet-stream

QUESTION:
Why only this: application/vnd.ms-excel is correct and those are not:
> application/x-msexcel
> application/ms-excel

Votes + Comments
Great!
4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by javaAddict
0

That's a job for a servlet, not a jsp.

The correct content type is the one registered with bodies like the w3c, not one that someone cooked up in his head because he thought it "sounds kewl".

0

That's a job for a servlet, not a jsp.

The correct content type is the one registered with bodies like the w3c, not one that someone cooked up in his head because he thought it "sounds kewl".

I used this and it worked
application/vnd.ms-excel

But I found in various sites other options as well:
http://www.utoronto.ca/webdocs/HTMLdocs/Book/Book-3ed/appb/mimetype.html
Search for "excel"

But the quote from the article I posted said that only the one I used is the correct one.

So is there any difference between the one I used and the others, or it is like you said, someone came up with these names and they never worked?

0

RFC - http://www.isi.edu/in-notes/rfc2045.txt


Beyond this syntax, the only syntactic constraint on the definition
of subtype names is the desire that their uses must not conflict.
That is, it would be undesirable to have two different communities
using "Content-Type: application/foobar" to mean two different
things. The process of defining new media subtypes, then, is not
intended to be a mechanism for imposing restrictions, but simply a
mechanism for publicizing their definition and usage. There are,
therefore, two acceptable mechanisms for defining new media subtypes:

(1) Private values (starting with "X-") may be defined
bilaterally between two cooperating agents without
outside registration or standardization. Such values
cannot be registered or standardized.

(2) New standard values should be registered with IANA as
described in RFC 2048.

Edited by __avd: n/a

1

Just a small addition to this issue.
We have been having some problems in displaying Greek character at the excel generated and after some tests it was discovered that in order to do that this tag also needed to be added at the <head> of the page.
Without it, it only displayed English characters:

<%@ page contentType="charset=iso-8859-7"%>

<%
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
%>


  <head>
        [B]<meta http-equiv="Content-Type" content="application/vnd.ms-excel;charset=UTF-8" />[/B]
  </head>

In case someone else is having the same problem

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.