I am using ListView to display report data with different colours for each item in listview. Then i am export listview data to excel file.
Data is comming correctly. But, i want to see same colours of listview rows in excel file also. I want to know is their any code to change the colour of excel rows
Loading
VasanthPosted Mar 31, 2010, 2:10 AM
string FileName = "";
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" expExcel.xls "");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter oWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(oWriter);
Table.RenderControl(htmlWrite);
Response.Write(oWriter.ToString());
Response.End();
If you're facing any error in Response.End (while debug ) , please check my forum to resolve the same in http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=82416
If it helps you , please mark as answer.