m.SetParameterValue("abc", DropDownList1.Text);
m.SetParameterValue("c",TextBox1.Text);
m.SetParameterValue("d", TextBox2.Text);
m.SetParameterValue("e", GridView1.Rows[GridView1.SelectedIndex].Cells[2].Text);
m.SetParameterValue("f", GridView1.Rows[GridView1.SelectedIndex].Cells[3].Text);
m.PrintToPrinter(1, true, 1, 1);
4 个解决方案
#1
没有人用这个功能吗?我不想导出pdf再打印,或者有没有其它报表控件可以实现该功能
#2
一个思路是做成ActiveX插件,调用服务获取数据后在客户端打印。
#3
页面后台的按钮事件里写:
页面前台:
protected 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>
#1
没有人用这个功能吗?我不想导出pdf再打印,或者有没有其它报表控件可以实现该功能
#2
一个思路是做成ActiveX插件,调用服务获取数据后在客户端打印。
#3
页面后台的按钮事件里写:
页面前台:
protected 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>