You can't cause the panes to freeze as you are not actually creating an Excel document. You are creating an HTML document with a .xls extension. HTML has no notion of "freezing panes". If you want to use Excel features, you need to generate a real Excel
document by either using Office Interop on the server, or ADO.NET to write to an existing file as if it is a database.
Dhanunjai
Member
82 Points
59 Posts
How to freeze Header Column in export to excel
Dec 06, 2012 04:43 AM|LINK
Dear Team,
Please help me in this issue how to freeze panes in export to excel using C# coding,Please find the below Export to excel code.
string attachment = "attachment; filename=Report.xls";
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("content-disposition", attachment);
HttpContext.Current.Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
DataReports.RenderControl(htw);
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
Mikesdotnett...
All-Star
154897 Points
19862 Posts
Moderator
MVP
Re: How to freeze Header Column in export to excel
Dec 06, 2012 05:16 AM|LINK
You can't cause the panes to freeze as you are not actually creating an Excel document. You are creating an HTML document with a .xls extension. HTML has no notion of "freezing panes". If you want to use Excel features, you need to generate a real Excel document by either using Office Interop on the server, or ADO.NET to write to an existing file as if it is a database.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Dhanunjai
Member
82 Points
59 Posts
Re: How to freeze Header Column in export to excel
Dec 06, 2012 05:21 AM|LINK
Dear Maikes,
Please provoide me if any code samples for the this issue.
Thanks for your reply...........
Mikesdotnett...
All-Star
154897 Points
19862 Posts
Moderator
MVP
Re: How to freeze Header Column in export to excel
Dec 06, 2012 06:43 AM|LINK
Here's an article that discusses using JET to write data to a .xls file: http://support.microsoft.com/kb/316934
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
PGaggar
Member
22 Points
19 Posts
Re: How to freeze Header Column in export to excel
Dec 06, 2012 01:35 PM|LINK
To generate the xlsx as well as xls file: http://forums.asp.net/p/1863741/5230401.aspx/1?Unable+to+generate+the+xlsx+file+
But i can't help you how to freeze the header column!!!