Setting mime type for excel document

0 votes

MS Excel has the following observed MIME types:

  • application/vnd.ms-excel (official)
  • application/msexcel
  • application/x-msexcel
  • application/x-ms-excel
  • application/x-excel
  • application/x-dos_ms_excel
  • application/xls
  • application/x-xls
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)

Is there any one type that would work for all versions? If not, do we need to set response.setContentType() with each one of these mime types individually?

Also, we use file streaming in our application to display document (not just excel - any type of document). In doing so, how can we retain the filename if the user opts to save the file - currently, the name of the servlet that renders the file appears as the default name.

Apr 1 in Database by Edureka
• 9,320 points
56 views

1 answer to this question.

0 votes

I assume application/vnd.ms-excel is the standard MIME type for Excel files.

You should provide the following header in the response when it comes to the document's name:

header('Content-Disposition: attachment; filename="name of excel file.xls"); 
answered Apr 4 by Edureka
• 8,820 points

Related Questions In Database

0 votes
1 answer

How to use xlrd for writing an excel file

In Python, you can read and write ...READ MORE

answered Mar 30 in Database by Edureka
• 8,820 points
26 views
0 votes
1 answer

I have a Run Time Error 91 for an Excel Add In

"Runtime Error 91: Object variable or with ...READ MORE

answered Mar 30 in Database by Edureka
• 8,820 points
46 views
0 votes
1 answer

How to translate a BDS excel-formula to XBBG API for Python

The parameters are improperly specified by you. ...READ MORE

answered Apr 1 in Database by Edureka
• 8,820 points
40 views
0 votes
1 answer
0 votes
1 answer

Excel formula for greater than but less than with several tiers

Use this: =MATCH(A1,{0,35,60,85,110}) READ MORE

answered Apr 5 in Database by Edureka
• 8,820 points
22 views
0 votes
1 answer

#NAME? error in Excel for VBA Function

Because you have a module with the ...READ MORE

answered Apr 5 in Database by Edureka
• 8,820 points
34 views
0 votes
1 answer

Excel vba for loop

You must understand how to use loops ...READ MORE

answered Apr 5 in Database by Edureka
• 8,820 points
51 views
0 votes
1 answer

I have a Run Time Error 91 for an Excel Add In

When there was no unhidden workbook open ...READ MORE

answered Apr 6 in Database by Edureka
• 8,820 points
33 views
0 votes
1 answer

Convert a number to a letter in C# for use in Microsoft Excel [duplicate]

If you are familiar with using formulas ...READ MORE

answered Feb 23 in Database by Edureka
• 8,820 points
37 views
0 votes
1 answer

Excel VBA - exit for loop

When we need to depart the For ...READ MORE

answered Mar 15 in Database by Edureka
• 8,820 points
26 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP