<TABLE id="tb3" style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid; BORDER-COLLAPSE: collapse" borderColor="#000000" cellSpacing="0" cellPadding="3" width="100%" align="center" border="1" runat="server"> <TR> <TD width="95"><FONT size="2">终端机系列号</FONT></TD> <TD width="135"><FONT size="2"> <asp:label id="lblPhoneSN_1" Runat="server"></asp:label></FONT></TD> <TD width="130"><FONT size="2">终端机使用电话号码</FONT></TD> <TD width="90"><FONT size="2"> <asp:label id="lblPhone_1" Runat="server"></asp:label></FONT></TD> <TD width="66"><FONT size="2">开通日期</FONT></TD> <TD width="90"><FONT size="2"> <asp:label id="lblOpenDate_1" Runat="server"></asp:label></FONT></TD> </TR> <TR> <TD><FONT size="2">终端机系列号</FONT></TD> <TD><FONT size="2"> <asp:label id="lblPhoneSN_2" Runat="server"></asp:label></FONT></TD> <TD><FONT size="2">终端机使用电话号码</FONT></TD> <TD><FONT size="2"> <asp:label id="lblPhone_2" Runat="server"></asp:label></FONT></TD> <TD><FONT size="2">开通日期</FONT></TD> <TD><FONT size="2"> <asp:label id="lblOpenDate_2" Runat="server"></asp:label></FONT></TD> </TR> <TR> <TD><FONT size="2">终端机系列号</FONT></TD> <TD><FONT size="2"> <asp:label id="lblPhoneSN_3" Runat="server"></asp:label></FONT></TD> <TD><FONT size="2">终端机使用电话号码</FONT></TD> <TD><FONT size="2"> <asp:label id="lblPhone_3" Runat="server"></asp:label></FONT></TD> <TD><FONT size="2">开通日期</FONT></TD> <TD><FONT size="2"> <asp:label id="lblOpenDate_3" Runat="server"></asp:label></FONT></TD> </TR> </TABLE> </TD> </TR> <TABLE id="tb4" style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid; BORDER-COLLAPSE: collapse" borderColor="#000000" cellSpacing="0" cellPadding="3" width="100%" align="center" border="1" runat="server"> <TR> <TD width="163"><FONT size="2">其中匹配的主电话号码</FONT></TD> <TD style="WIDTH: 81px" width="81"><FONT size="2"> <asp:label id="lblMainPhone" Runat="server"></asp:label></FONT></TD> <TD width="163"><FONT size="2">终端机初始密码统一为</FONT></TD> <TD width="140"><FONT size="2">123456(请及时修改)</FONT></TD> </TR> <TR> <TD align="center" colSpan="4"><FONT size="2">商家后台管理控制系统使用说明</FONT></TD> </TR> </TABLE> 后台 DateTime dtime = DateTime.Now; string FileName = dtime.Year.ToString() + "-" + dtime.Month.ToString() + "-" + dtime.Day.ToString() + "~" + dtime.Hour.ToString() + "-" + dtime.Minute.ToString() + "-" + dtime.Second.ToString() + "-" + dtime.Millisecond.ToString() + ".doc"; string Path = Server.MapPath("../PhoneSN_doc/" + FileName); StreamWriter sr = File.CreateText(Path); StringWriter tw = new StringWriter(); HtmlTextWriter hw=new HtmlTextWriter(tw); //tb0.RenderControl(hw); tb1.RenderControl(hw); tb2.RenderControl(hw); tb3.RenderControl(hw); tb4.RenderControl(hw); tb8.RenderControl(hw); tb5.RenderControl(hw); tb6.RenderControl(hw); tb7.RenderControl(hw); sr.Write(tw.ToString()); tw.Close(); sr.Close(); System.IO.FileInfo file = new System.IO.FileInfo(Path); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(file.FullName); Response.End(); 实现打印 相关文章: