2

I have a requirement where I have to convert the report generated to an .xls file. I have done this successfully on desktops, but when I test it on iPads or Android tablets, it can't open the sheet. I'm confused about why. Am I missing any specific header or content type?

I have used this Header and ContentType:

Response.ContentType = "application/vnd.ms-excel"; 
Response.AddHeader("Content-disposition", "attachment; filename=table.xls");
MarredCheese
  • 17,541
  • 8
  • 92
  • 91
Mgn
  • 39
  • 3
  • 1
    How do you create the xls file? Using original Excel components or 3rd party library? If the latter is true have you tested if the iOS app can open the created xls files without downloading them (use the file locally)? – Robert Jul 17 '12 at 12:19
  • https://discussions.apple.com/thread/3875958 – Kevin Main Jul 17 '12 at 13:01

1 Answers1

0

in this way you set the content type.. BUT how do you generate the xls?

microsoft office automatically convert an HTML page in excel-like format simply changing the content type: if there's a table in the page, it will become an excel table!

but other software aren't so versatile... you should always use a properly formatted XLS file.

AndreaCi
  • 809
  • 1
  • 9
  • 22
  • yes you're right. The html page will automatically convert into excel, if we are using the content type. I'm formatting the html table as to fit with the excel table. so we do i need to generate the new excel sheet using the ranges and interop excel component??? – Mgn Jul 18 '12 at 07:57
  • yes.. but it will convert automatically only using microsoft office.. Refer to this to "explore" various ways to create excel documents: http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp – AndreaCi Jul 18 '12 at 17:48