62,046
社区成员
发帖
与我相关
我的任务
分享
public void btnPrint_Click(object sender, EventArgs e)
{
Page.RegisterStartupScript("", "<script> document.all.WebBrowser.ExecWB(7,1);<" + "/script>");
}
页面前台:
<head runat="server">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<META http-equiv="Expires" content="-1">
<style media="print">.Noprint { DISPLAY: none }
</style>
</head>
<body style="width: 100%; text-align: center;">
<form id="form1" runat="server">
<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>
<div style="width: 100%; text-align: center" class="Noprint">
<asp:Button ID="btnPrint" runat="server" Text="确定打印" OnClick="btnPrint_Click" />
</div>
</form>
</body>