Exporting to Excel from SQL via ASP.NET...preserving HTML formatting?
I am trying to export to Excel from SQL. My problem is not actually getting the export to work, but preserving the HTML formatting present in the SQL tables I am pulling from. When I export to Excel, either via a Datagrid bound w/the data or a custom function I have written which dumps to .csv, it goes through correctly but garbage characters appear every time a bullet point or some other non-standard formatting was present in the table.
I know this formatting has been preserved in SQL so it's still there, it's just not making it through to the spreadsheet. I have tried doing a manual export in SQL Enterprise Manager to a text file and surprisingly the bullets and other such formatting were preserved there. I just don't know why it won't show up in Excel. Actually when I loaded that text file into Excel the bullet points did make it through in that case, but they still don't when I dump to .csv or export from a Datagrid to Excel.
I am using ASP.NET 1.x and SQL 2000. When I export to .csv, I am first putting all the data into a custom datatable, then writing the contents of that datatable using a streamwriter.