In my ASP.NET Web-form Project I have an Event which Export Data (List<Profit>
) to Excel . I'm using the old fashion way , writing to HTML file with .XLS extenstionmode
Profit
Entity has some string properties which has numeric data like "100000561234"
When I export to Excel , Those Columns appear like 1.00001E+11
in Excel columns, So the user has to Right-Click on Excel column and change format-cell.
Any help appreciated
Simply Add the following line before your HTML code, it will resolve the issue. This style sheet will be applied on every cell and no need to format the cell as string manually.
Response.Write("<style> TD { mso-number-format:\@; } </style>");