各位高手,有谁知道怎么用vs.net 里面的打印预览控件?
解决方案 »
- gridview的RowDataBound事件中设置了隐藏某列后就无法使用分页了,求救!
- 在ASP.NET中可以使用Beep(),但只能在服务端发声,是否有办法让他在客户端发声?
- 用js如何读取两标签数据
- 100分求原代码,关于上传和在线评分的!
- aspnetdb数据库的添加
- 100分挑戰.net框架的局限﹐自定義control繼承后baseControl的controls.add無效﹐歡迎各高手探討
- ▲▲▲公司开始订明年的杂志,大家知道有什么.NET方面的杂志?▲▲▲
- 高手救命~~~~~~~~~~(Excel導入數據庫中的問題)
- 过程或函数 'StoredProcedure1' 需要参数 '@starttime',但未提供该参数。
- 好久不来csdn,问候一声,大家都还好吧!
- 关于两个以上DropDownList控件联级反映不同分类内容的问题.
- 怎么在ASPX里截一定数量的字符串
<head>
<style type="text/css" media="print">
DIV.d1 { DISPLAY: none }
</style>
</head>
<body>
打印可以这样实现(仅作简单示例):
也可把那个CAB文件下载到本地服务器再引用它.<br/>
在这里加入打印内容及控制分页............
<div class="d1">
<OBJECT id="MyPrinter" style="DISPLAY: none" codeBase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" viewastext>
</OBJECT>
<SCRIPT defer>
function window.onload() {
MyPrinter.printing.header = ""
MyPrinter.printing.footer = ""
MyPrinter.printing.portrait=true
MyPrinter.printing.leftMargin =5
MyPrinter.printing.topMargin = 5
MyPrinter.printing.rightMargin = 1
MyPrinter.printing.bottomMargin = 1
//MyPrinter.printing.paperSize="Letter"
}
</SCRIPT>
<input style="WIDTH: 87px; HEIGHT: 24px" onclick='document.execCommand("print")' type="button" value="打印...">
<!-- <INPUT onclick=MyPrinter.printing.Print(false) type=button value=打印本頁> -->
<input name="button" type="button" onClick="MyPrinter.printing.PageSetup()" value="页面设置">
<INPUT onclick="MyPrinter.printing.Preview()" type="button" value="打印预览"> <br/>
</div>
</body>
</html>
<script language="javascript">
function printsetup(){
// 打印页面设置
wb.execwb(8,1);
}
function printpreview(){
// 打印页面预览
wb.execwb(7,1);
}
function printit()
{
if (confirm('确定打印吗?')) {
wb.execwb(6,6)
}
}
</script>
</head>
<body> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
<input type=button name=button_print value="打印" onclick="javascript:printit()">
<input type=button name=button_setup value="打印页面设置" onclick="javascript:printsetup();">
<input type=button name=button_show value="打印预览" onclick="javascript:printpreview();">
<input type=button name=button_fh value="关闭" onclick="javascript:window.close();">
然后再设置PrintPage事件
还有打印机什么的
就可以了