Datagrid --> Excel Spreadsheet - A "small detail" question

D

Dave

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())



In the datagrid, I use colored backgrounds. There is a default white
background, and four other colors that I use. After exporting, the
spreadsheet only retains the white background and one of the other colors
(System.Drawing.Color.FromName("#e38a00"). The other three colors (nothing
special - ff0000, 00ff00, ffff00 - red, green, and yellow) are lost in the
move.


Now, my questions:

- Am I supposed to be able to maintain colored cells during the move?

- If so, do you know or see anything obvious I need to do?

Thanks,

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top