<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="NeiMengDispatchOrder.WebForm1" %>
<HTML>
<HEAD>
<title>看看</title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media="print">
.Noprint ...{ DISPLAY: none }
.PageNext ...{ PAGE-BREAK-AFTER: always }
</style>
<style>
.tdp ...{ BORDER-RIGHT: #ffffff 0px solid; BORDER-TOP: #ffffff 0px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid }
.tabp ...{ BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid }
.NOPRINT ...{ FONT-SIZE: 9pt; FONT-FAMILY: "宋体" }
</style>
</HEAD>
<body>
<center class="Noprint">
<p>
<OBJECT id="WebBrowser" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
VIEWASTEXT>
<PARAM NAME="ExtentX" VALUE="26">
<PARAM NAME="ExtentY" VALUE="26">
<PARAM NAME="ViewMode" VALUE="0">
<PARAM NAME="Offline" VALUE="0">
<PARAM NAME="Silent" VALUE="0">
<PARAM NAME="RegisterAsBrowser" VALUE="0">
<PARAM NAME="RegisterAsDropTarget" VALUE="1">
<PARAM NAME="AutoArrange" VALUE="0">
<PARAM NAME="NoClientEdge" VALUE="0">
<PARAM NAME="AlignLeft" VALUE="0">
<PARAM NAME="NoWebView" VALUE="0">
<PARAM NAME="HideFileNames" VALUE="0">
<PARAM NAME="SingleClick" VALUE="0">
<PARAM NAME="SingleSelection" VALUE="0">
<PARAM NAME="NoFolders" VALUE="0">
<PARAM NAME="Transparent" VALUE="0">
<PARAM NAME="ViewID" VALUE="{0057D0E0-3573-11CF-AE69-08002B2E1262}">
</OBJECT>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)"> <input type="button" value="直接打印" onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
</p>
<p>
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
<br>
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
<form id="Form1" method="post" runat="server">
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td colspan="3" class="tdp">第1页</td>
</tr>
<tr>
<td width="29%" class="tdp">
<asp:Label id="Label2" runat="server">Label</asp:Label></td>
<td width="28%" class="tdp">
<asp:Label id="Label1" runat="server">Label</asp:Label></td>
<td width="43%" class="tdp">
<asp:DropDownList id="DropDownList1" runat="server"></asp:DropDownList></td>
</tr>
<tr>
<td colspan="3" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<hr align="center" width="90%" size="1" noshade class="NOPRINT">
<!--分页-->
<div class="PageNext"></div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第2页</td>
</tr>
<tr>
<td class="tdp">看到分页了吧</td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</HTML>
本文介绍了一种使用 ASP.NET 实现网页打印功能的方法,通过内嵌 ActiveX 控件 WebBrowser 实现了打印、打印预览等功能,并展示了具体的 HTML 和参数配置。

被折叠的 条评论
为什么被折叠?



