本文介绍了如何将页眉放在Excel报表中.....从C#中导出Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将标题(日期,哪种类型的报告公司名称)放在Excel工作表报表的顶部..... Im从C#.Net导出Excel工作表...我的代码在下面
受保护的 void btnExcel_Click1(对象发件人,ImageClickEventArgs e) { Response.Clear(); Response.AddHeader(" Content-Disposition" ," 附件; filename = AttandanceReport.xls"); Response.Charset = " " ; Response.ContentType = " application/vnd.xls" ; System.IO.StringWriter stringWrite = 新 System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = 新 HtmlTextWriter(stringWrite); // grdreport1.BorderStyle = BorderStyle.Solid; // grdreport1.BorderWidth = 1; // grdreport1.BackColor = Color.WhiteSmoke; // grdreport1.GridLines = GridLines.Both; grdreport1.Font.Name = " Verdana" ; grdreport1.Font.Size = FontUnit.XXSmall; // grdreport1.HeaderStyle.BackColor = Color.DimGray; // grdreport1.HeaderStyle.ForeColor = Color.White; grdreport1.RowStyle.HorizontalAlign = HorizontalAlign.Center; grdreport1.RowStyle.VerticalAlign = VerticalAlign.Top; grdreport1.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }
解决方案
这篇关于如何将页眉放在Excel报表中.....从C#中导出Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!