Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
           Here is my code
             ExportedTable = "<table><th></th>Name<th></th><th>Mobile</th><th>Adress</th> <tr><td>XYZ</td><td>123456789</td><td>XYZ</td></tr>  </table>";
            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment;filename=Overview.xls");
            Response.Charset = "";
            Response.ContentType = "application/vnd.ms-excel";
            string style = @"<style> TABLE { border: thin solid black; } TD { border: thin solid black; } </style> ";
            Response.Write(style);
            Response.Output.Write(ExportedTable.ToString());
            Response.Flush();
            Response.End();

Now its work fine in windows browsers when i export data in mobile its give HTLM in excel file.
I am stuck in this problem how to resolve this?


What I have tried:

Export to excel not working when open in mobile.
Posted
Updated 19-Aug-16 23:09pm
v2
Comments
Patrice T 20-Aug-16 3:22am    
Do you have Excel on mobile ?
MAYANK GEETE 20-Aug-16 5:01am    
Yes i have. When i open that excel it will data with HTML Tags.

1 solution

You are not creating an Excel file, you are just sending HTML with the XLS file extension, Excel on mobile is not like desktop and does not have all the features like detecting the input and reading whatever you give it.

Try creating real XLSX files with : EPPlus-Create advanced Excel spreadsheets on the server - Home[^]
 
Share this answer
 
Comments
MAYANK GEETE 20-Aug-16 5:51am    
Any other option to do that?
Mehdi Gholam 20-Aug-16 5:58am    
Not if you want Excel files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900