In a VB.NET application, I have a datagrid that I export to an Excel
spreadsheet like this:
' Set the content type to Excel
Response.ContentType = "application/vnd.ms-excel"
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' Get the HTML for the control.
DataGrid1.RenderControl(hw)
' Write the HTML back to the browser.
Response.Write(tw.ToString())
Now, my question is this: In the datagrid, I use colored text and
backgrounds. After exporting, the spreadsheet loses this coloring.
- Am I supposed to be able to maintain colored cells?
- If so, do you know or see anything obvious I need to do?
Thanks,
Dave