如何用程序调用出IE的打印,打印预览,页面设置这三个东西啊 使用API,以前asp里肯定不行,据我所知。。.net应该可以,不过没有做过。关注。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try<style>@media print{.h{display:none}.onlyPrint{page-break-before:always}}@media screen{.onlyPrint{display:none}.onlyPrint1{display:none}.onlyPrint2{display:none}}</style><object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="../include/ScriptX.cab#Version=5,60,0,360""></object><script defer>function window.onload() { try{ factory.printing.header = ""; factory.printing.footer = ""; } catch(e){ alert("Error occured when initializing your printing page setup. Please make sure you have installed a printer on your computer."); } //factory.printing.leftMargin = 0.75 //factory.printing.topMargin = 0.5 //factory.printing.rightMargin = 0.75 //factory.printing.bottomMargin = 1.5 }<!--function preView(){try{factory.printing.Preview();}catch(e){alert("Your browser doesn't support this function")}}//--></script></head><div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" width="648" height="866"> <tr> <td colspan="5" align="center" height="27" class="h"> <input type="button" onClick="preView()" value="Preview" class="button" id="button1" name="button1"> <input type="button" onclick="factory.printing.Print(false);" value="Print" class="button" style="WIDTH: 60px; HEIGHT: 16px" id="button2" name="button2"> <input type="button" onclick="window.close();" value="Close" class="button" id="button1" name="button1" style="WIDTH: 60px; HEIGHT: 16px"> </td> </tr><table>:) <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=WebBrowser width=0></OBJECT><table><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=打印>不会弹出打印机窗口</td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览 ></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=查看页面属性></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(15,1) type=button value=撤销></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(17,1) type=button value=全选></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新></td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=关闭窗体无提示></td></tr><tr><td><input type=button value=刷新 name=refresh onclick="window.location.reload()"></td></tr><tr><td></td></tr><tr><td><input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,'');></td></tr><tr><td><input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,'');></td></tr><tr><td><INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹></td></tr><tr><td><INPUT name=Submit2 onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)" type=button value=整理收藏夹></td></tr><tr><td><INPUT name=Button onclick='window.location = "view-source:" + window.location.href' type=button value=查看源文件></td></tr><tr><td><INPUT name=Button onclick="window.external.ShowBrowserUI('LanguageDialog', null)" type=button value=语言设置></td></tr><tr><td><INPUT name=Submit onclick=history.go(1) type=submit value=前进></td></tr><tr><td><INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退></td></tr><tr><td><input type=button value=加入到频道 onclick="window.external.addChannel('http://www.meizz.com/') "> </td></tr> 我也遇到了同样的难题如下:<OBJECT id="WebBrowser" codeBase="127.0.0.1/XMJTJXT/WebXMJ_TJXT/Cz_Sxnmclzl.aspx" 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}"> <PARAM NAME="Location" VALUE=""> </OBJECT>当其他按钮事件发生时,打不开网叶,浏览器显示:“///”我在<PARAM NAME="Location" VALUE="127.0.0.1">添加了‘127.0.0.1‘ ,其他按钮能正常运行,可是执行打印按钮的时候,则提示:“网叶错误” 高手: greystar 帮帮我! 請問“WebBrowser”是什麼控件?在ASP。NET中能用嗎,怎麼用?謝謝! upwebbrowser在asp.net中怎么用啊????????????????????? webbrowser 是IE的控件只能在客户端脚本中使用 to yilianyin(yly) :<PARAM NAME="Location" VALUE="">去掉!或者 <object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object><script language=javascript>function window.onload(){ factory.printing.header = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页" factory.printing.footer = "(自定义页脚)" factory.printing.leftMargin = 0.75 factory.printing.topMargin = 1.5 factory.printing.rightMargin = 0.75 factory.printing.bottomMargin = 1.5}</script><input type=button value="打印本页" onclick="factory.printing.Print(false)"><input type=button value="页面设置" onclick="factory.printing.PageSetup()"><input type=button value="打印预览" onclick="factory.printing.Preview()"> <html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style>.tdp{ border-bottom: 1 solid #000000; border-left: 1 solid #000000; border-right: 0 solid #ffffff; border-top: 0 solid #ffffff;}.tabp{ border-color: #000000 #000000 #000000 #000000; border-style: solid; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 1px; border-left-width: 1px;}</style></head><body onbeforeprint="printsub.style.display='none';" onafterprint="printsub.style.display='';"><center><input type=button name="printsub" value=" 打印 " onclick="self.print();"><br></center><table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp"> <tr align="center"> <td height="25" colspan="3" class="tdp"><strong>计算机世界开发者俱乐部</strong></td> </tr> <tr> <td width="31%" height="26" align="center" class="tdp">PHP版</td> <td width="34%" align="center" class="tdp">DELPHI版</td> <td width="35%" align="center" class="tdp">JAVA版</td> </tr> <tr> <td height="40" colspan="3" class="tdp"><p>一段很小但很实用的CSS打印样式。一般带背景的表格在打印的时候,页面上看到的格线实际却打印不出来。其实不是打印不出来,是需要在打印的时候选择"打印背景"。1般不可能要求用户必须做这步。但用样式表"画"出来的格线在打印的时候就能得到"所见即所打"的效果。这效果当然不能和专业的打印控件如"水晶报表"想比,但满足普通的需求还是能够胜任的。</p></td> </tr> <tr> <td height="59" colspan="3" class="tdp">但在打印的时候,"打印"按纽不能被打印出来,所以就在<body>里用两个事件来控制它,这步很重要。</td> </tr> <tr> <td height="59" colspan="3" class="tdp">在使用这两个样式时,1个是让<table>的class="tabp",然后再它下面的每个<td>的class="tdp",<tr>不需要指定。记住,每个<td>都要指定一下。</td> </tr> <tr> <td height="59" colspan="3" class="tdp">打印效果如图:(打印出的东东不包括菜单,只有下面的内容):</td> </tr></table></body></html> 用一下代码实现:<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></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)> <input type=button value="打印OK" onclick=" return myprint(this);"> <input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)> 用户代码未处理 EntityCommandExecutionException 项目开发 js中 保留几位小数 datagrid分页 弹出新页,显示xml文件 急!!怎么使用ImageButton实现datagrid 的自定义分页 asp.net中怎么调用sqlxml中的template中的查询数据 为什么数据在看不到,我这样写错在哪,很急(在线等) .net 发邮件方式之请教及讨论(来者有分) 高分求asp.net导出到excel的例子! 高手请进!!!!!UPDATE,INSERT,DELETE语句都对,就是无法更新数据源 一个简单的自动提交问题
<style>
@media print{
.h{display:none}
.onlyPrint{page-break-before:always}
}
@media screen{.onlyPrint{display:none}.onlyPrint1{display:none}.onlyPrint2{display:none}}</style>
<object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="../include/ScriptX.cab#Version=5,60,0,360""></object>
<script defer>
function window.onload() {
try{
factory.printing.header = "";
factory.printing.footer = "";
}
catch(e){
alert("Error occured when initializing your printing page setup. Please make sure you have installed a printer on your computer.");
}
//factory.printing.leftMargin = 0.75
//factory.printing.topMargin = 0.5
//factory.printing.rightMargin = 0.75
//factory.printing.bottomMargin = 1.5
}<!--
function preView(){try{factory.printing.Preview();}catch(e){alert("Your browser doesn't support this function")}}//-->
</script>
</head>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="648" height="866">
<tr>
<td colspan="5" align="center" height="27" class="h">
<input type="button" onClick="preView()" value="Preview" class="button" id="button1" name="button1">
<input type="button" onclick="factory.printing.Print(false);" value="Print" class="button" style="WIDTH: 60px; HEIGHT: 16px" id="button2" name="button2">
<input type="button" onclick="window.close();" value="Close" class="button" id="button1" name="button1" style="WIDTH: 60px; HEIGHT: 16px">
</td> </tr>
<table>:)
<table><tr><td>
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
</td></tr><tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=打印>不会弹出打印机窗口</td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览 ></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=查看页面属性></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(15,1) type=button value=撤销></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(17,1) type=button value=全选></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新></td></tr>
<tr><td><input name=Button onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=关闭窗体无提示></td></tr>
<tr><td><input type=button value=刷新 name=refresh onclick="window.location.reload()">
</td></tr>
<tr><td></td></tr>
<tr><td><input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,'');></td></tr>
<tr><td><input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,'');></td></tr>
<tr><td><INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹></td></tr>
<tr><td><INPUT name=Submit2 onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)" type=button value=整理收藏夹></td></tr>
<tr><td><INPUT name=Button onclick='window.location = "view-source:" + window.location.href' type=button value=查看源文件></td></tr><tr><td><INPUT name=Button onclick="window.external.ShowBrowserUI('LanguageDialog', null)" type=button value=语言设置></td></tr>
<tr><td><INPUT name=Submit onclick=history.go(1) type=submit value=前进></td></tr>
<tr><td><INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退></td></tr>
<tr><td><input type=button value=加入到频道 onclick="window.external.addChannel('http://www.meizz.com/') ">
</td></tr>
如下:
<OBJECT id="WebBrowser" codeBase="127.0.0.1/XMJTJXT/WebXMJ_TJXT/Cz_Sxnmclzl.aspx" 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}">
<PARAM NAME="Location" VALUE="">
</OBJECT>
当其他按钮事件发生时,打不开网叶,浏览器显示:“///”
我在<PARAM NAME="Location" VALUE="127.0.0.1">添加了‘127.0.0.1‘ ,其他按钮能正常运行,可是执行打印按钮的时候,则提示:“网叶错误”
高手: greystar 帮帮我!
webbrowser在asp.net中怎么用啊?????????????????????
去掉!
或者
codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object>
<script language=javascript>
function window.onload()
{
factory.printing.header = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页"
factory.printing.footer = "(自定义页脚)"
factory.printing.leftMargin = 0.75
factory.printing.topMargin = 1.5
factory.printing.rightMargin = 0.75
factory.printing.bottomMargin = 1.5
}
</script>
<input type=button value="打印本页" onclick="factory.printing.Print(false)">
<input type=button value="页面设置" onclick="factory.printing.PageSetup()">
<input type=button value="打印预览" onclick="factory.printing.Preview()">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
</style>
</head><body onbeforeprint="printsub.style.display='none';" onafterprint="printsub.style.display='';">
<center><input type=button name="printsub" value=" 打印 " onclick="self.print();"><br></center>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr align="center">
<td height="25" colspan="3" class="tdp"><strong>计算机世界开发者俱乐部</strong></td>
</tr>
<tr>
<td width="31%" height="26" align="center" class="tdp">PHP版</td>
<td width="34%" align="center" class="tdp">DELPHI版</td>
<td width="35%" align="center" class="tdp">JAVA版</td>
</tr>
<tr>
<td height="40" colspan="3" class="tdp"><p>一段很小但很实用的CSS打印样式。一般带背景的表格在打印的时候,页面上看到的格线实际却打印不出来。其实不是打印不出来,是需要在打印的时候选择"打印背景"。1般不可能要求用户必须做这步。但用样式表"画"出来的格线在打印的时候就能得到"所见即所打"的效果。这效果当然不能和专业的打印控件如"水晶报表"想比,但满足普通的需求还是能够胜任的。</p></td>
</tr>
<tr>
<td height="59" colspan="3" class="tdp">但在打印的时候,"打印"按纽不能被打印出来,所以就在<body>里用两个事件来控制它,这步很重要。</td>
</tr>
<tr>
<td height="59" colspan="3" class="tdp">在使用这两个样式时,1个是让<table>的class="tabp",然后再它下面的每个<td>的class="tdp",<tr>不需要指定。记住,每个<td>都要指定一下。</td>
</tr>
<tr>
<td height="59" colspan="3" class="tdp">打印效果如图:(打印出的东东不包括菜单,只有下面的内容):</td>
</tr>
</table>
</body>
</html>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></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)>
<input type=button value="打印OK" onclick=" return myprint(this);">
<input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>