问题描述
string filename =FY15输入集合模板_+ 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) );
tbfourtb.RenderControl(hw);
tbfrtable.RenderControl(hw);
this.EnableViewState = false;
Response.Write(tw.ToString());
Response.Flush();
Response.End();
hai罚款excel表正在下载,但我的任务是只启用excel表中的表格单元格和留下来的单元格应该像Free-editable一样冻结请指导我我怎么能这样做..
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);
tbfourtb.RenderControl(hw);
tbfrtable.RenderControl(hw);
this.EnableViewState = false;
Response.Write(tw.ToString());
Response.Flush();
Response.End();
hai its fine the excel sheet was downloading but my task is to enable only table cells in excel sheet and remainig cells should be freezed like Un-editable please guide me how can i do that..
这篇关于要导出的Html表到excel表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!