Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am exporting asp tables to excel but i want to make table headers non-editable please guide me....




C#
Response.ClearContent();
                string filename = "FY15 Input Collection Template_" + ddlcity.SelectedItem.Text + ".xls";
                Response.AddHeader("content-disposition", "attachment;filename=" + filename);
                Response.Charset = "UTF-8";
                Response.ContentType = "application/vnd.ms-excel";
                StringWriter tw = new StringWriter();
                HtmlTextWriter hw = new HtmlTextWriter(tw);
                Microsoft.Office.Interop.Excel.ApplicationClass _ExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
                _ExcelApp.DisplayAlerts = false;
                tbcity.RenderControl(hw);
                tbannualpercent.RenderControl(hw);
                tblasm.RenderControl(hw);
                tbtwotable.RenderControl(hw);
                tbsectb.RenderControl(hw);
                tbthreetb.RenderControl(hw);
                tbthirdtb.RenderControl(hw);
                this.EnableViewState = false;
                Response.Write(tw.ToString());
                Response.Flush();
                Response.End();



this is how i tried its exporting to excel but how can i make table headers as non-editable in excel...i am not getting excel sheet instance to lock cells please any one help me...
Posted
Updated 5-Mar-14 17:03pm
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900