This is a migrated thread and some comments may be shown as answers.

Ajax Manager is scrambling file download

1 Answer 45 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Samuel Davis
Top achievements
Rank 1
Samuel Davis asked on 27 May 2010, 02:45 PM
We have a page in our application in which we allow for uploads of an excel file and then allow for a download of two generated excel files.  In order to make the file upload work without two postbacks we added the enctype code (Me.Page.Form.Enctype = "multipart/form-data").  This fixed the two postbacks and everything seemed to be working in IE but then we found that in Mozilla one of our download buttons was returning a scrambled excel file.  The following is part of the code that assigns the type and file extension to the generated excel file.

Private Const ExcelContentType As String = "application/vnd.ms-excel"
Private Const ExcelFileExtension As String = "xls"

Keep in mind that it completely works in IE, and that one of the buttons is working in Firefox but not the other.

1 Answer, 1 is accepted

Sort by
0
Samuel Davis
Top achievements
Rank 1
answered on 27 May 2010, 05:02 PM
I had been working on this for a while but i was able to solve this for anyone who faces the same issue.

Basically if you import the office.interop dll version 11.0.0.0 it will automatically update to the newest version.  The newest version will generate excel files in the .xlsx format (even though we never specified that).  SOMEHOW Internet Explorer is able to parse a xlsx file as xls and you are fine, but Mozilla will not.

Basically set the Application.DefaultSaveFormat = 56 and you will be good for making .xls files.
Tags
Ajax
Asked by
Samuel Davis
Top achievements
Rank 1
Answers by
Samuel Davis
Top achievements
Rank 1
Share this question
or