Ajax Manager is scrambling file download

2 posts, 0 answers
  1. Samuel Davis
    Samuel Davis avatar
    12 posts
    Member since:
    Feb 2010

    Posted 27 May 2010 Link to this post

    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.
  2. Samuel Davis
    Samuel Davis avatar
    12 posts
    Member since:
    Feb 2010

    Posted 27 May 2010 Link to this post

    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.
Back to Top