js WebBrowser 打印 套打
来源:互联网 发布:erp软件销售好做吗 编辑:程序博客网 时间:2024/04/29 01:33
WebBrowser 打印 套打
网页打印代码
<style media=print>
.Noprint{display:none;}
</style>
<script language="JavaScript">
function dayin(){window.print()}
function dayin1(){try{document.all.WebBrowser.ExecWB(6,6)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function pageSetup(){try{document.all.WebBrowser.ExecWB(8,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function preView(){try{document.all.WebBrowser.ExecWB(7,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<p>页面打印测试</p>
<p><span class="Noprint">测试1:
<input type=button value=打印 onclick="window.print()">
<INPUT type=button value=打印 onclick="document.execCommand('Print')">
</span>
</p>
<p class="Noprint">测试2:
<input class="Noprint" type=button value=打印 onclick="dayin()">
<input class="Noprint" type=button value=直接打印 onclick="dayin1()">
<input class="Noprint" type=button value=页面设置 onclick="pageSetup()">
<input class="Noprint" type=button value=打印预览 onclick="preView()">
</p>
<style media=print>
.Noprint{display:none;}
</style>
<script language="JavaScript">
function dayin(){window.print()}
function dayin1(){try{document.all.WebBrowser.ExecWB(6,6)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function pageSetup(){try{document.all.WebBrowser.ExecWB(8,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function preView(){try{document.all.WebBrowser.ExecWB(7,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<p>页面打印测试</p>
<p><span class="Noprint">测试1:
<input type=button value=打印 onclick="window.print()">
<INPUT type=button value=打印 onclick="document.execCommand('Print')">
</span>
</p>
<p class="Noprint">测试2:
<input class="Noprint" type=button value=打印 onclick="dayin()">
<input class="Noprint" type=button value=直接打印 onclick="dayin1()">
<input class="Noprint" type=button value=页面设置 onclick="pageSetup()">
<input class="Noprint" type=button value=打印预览 onclick="preView()">
</p>
<style media=print>
.Noprint{display:none;}
</style>
<script language="JavaScript">
function dayin(){window.print()}
function dayin1(){try{document.all.WebBrowser.ExecWB(6,6)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function pageSetup(){try{document.all.WebBrowser.ExecWB(8,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function preView(){try{document.all.WebBrowser.ExecWB(7,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<p>页面打印测试</p>
<p><span class="Noprint">测试1:
<input type=button value=打印 onclick="window.print()">
<INPUT type=button value=打印 onclick="document.execCommand('Print')">
</span>
</p>
<p class="Noprint">测试2:
<input class="Noprint" type=button value=打印 onclick="dayin()">
<input class="Noprint" type=button value=直接打印 onclick="dayin1()">
<input class="Noprint" type=button value=页面设置 onclick="pageSetup()">
<input class="Noprint" type=button value=打印预览 onclick="preView()">
</p>
首先在网页中添加:
<OBJECT id="WebBrowser" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
VIEWASTEXT>
</OBJECT>
然后就可以依次加入功能按钮了:
<input onclick="document.all.WebBrowser.ExecWB(6,1)" type="button" value="打印"> <input onclick="document.all.WebBrowser.ExecWB(6,6)" type="button" value="直接打印">
<input onclick="document.all.WebBrowser.ExecWB(8,1)" type="button" value="页面设置">
<input onclick="document.all.WebBrowser.ExecWB(7,1)" type="button" value="打印预览"> <INPUT type="button" value="关闭窗口" onclick="javascript:window.close()">
将这两块东西放到<center class=noprint></center>就不会打印这些按钮了。当然要定义noprint了:
<style media="print">.Noprint { DISPLAY: none }</style>只要把不想打印的东西的css设置成noprint就可以了。
现在就实现了基本的web打印,需要注意的情况如下:
必须将ie的internet选项的安全设置中对于没有标记为安全的ActiveX控件进行...设置成提示或者启用,否则会报错,导致不可用。
如果在vs.net编辑环境下编辑该页面,它经常自动的给object添加多余的参数,有了这些东西,打印就会出错,所以要记得最后保存的时候删除它们。
为了简便并且达到最好的效果,我们可以在一个页面实现编辑和打印,这时候会需要很多的textbox,我们把它的css设置成.edittext
{
overflow-y:visible;
width: 100%;
border-top: none;
border-right: none;
border-bottom: none;
border-left: none;
}就可以实现在打印的时候不显示边框和multiline的textbox不显示滚动条了。
还有一些小经验就是在设置标格宽度的时候,对于A4纸张,横打用920,竖打用640,效果最好。
用CSS实现表格单元格数据自动换行或不换行
用CSS实现表格单元格数据自动换行或不换行
1、自动换行:
<style type="text/css">
.AutoNewline
{
word-break: break-all;/*必须*/
}
</style>
<table>
<tr>
<td class="AutoNewline">自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行</td>
</tr>
</table>
2、不换行:
<style type="text/css">
.NoNewline
{
word-break: keep-all;/*必须*/
}
</style>
<table>
<tr>
<td class="NoNewline">不换行不换行不换行不换行不换行不换行不换行不换行不换行不换行</td>
</tr>
</table>
<style media=print>
.Noprint{display:none;}
</style>
<script language="JavaScript">
function dayin(){window.print()}
function dayin1(){try{document.all.WebBrowser.ExecWB(6,6)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function pageSetup(){try{document.all.WebBrowser.ExecWB(8,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function preView(){try{document.all.WebBrowser.ExecWB(7,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<p>页面打印测试</p>
<p><span class="Noprint">测试1:
<input type=button value=打印 onclick="window.print()">
<INPUT type=button value=打印 onclick="document.execCommand('Print')">
</span>
</p>
<p class="Noprint">测试2:
<input class="Noprint" type=button value=打印 onclick="dayin()">
<input class="Noprint" type=button value=直接打印 onclick="dayin1()">
<input class="Noprint" type=button value=页面设置 onclick="pageSetup()">
<input class="Noprint" type=button value=打印预览 onclick="preView()">
</p>
<style media=print>
.Noprint{display:none;}
</style>
<script language="JavaScript">
function dayin(){window.print()}
function dayin1(){try{document.all.WebBrowser.ExecWB(6,6)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function pageSetup(){try{document.all.WebBrowser.ExecWB(8,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function preView(){try{document.all.WebBrowser.ExecWB(7,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<p>页面打印测试</p>
<p><span class="Noprint">测试1:
<input type=button value=打印 onclick="window.print()">
<INPUT type=button value=打印 onclick="document.execCommand('Print')">
</span>
</p>
<p class="Noprint">测试2:
<input class="Noprint" type=button value=打印 onclick="dayin()">
<input class="Noprint" type=button value=直接打印 onclick="dayin1()">
<input class="Noprint" type=button value=页面设置 onclick="pageSetup()">
<input class="Noprint" type=button value=打印预览 onclick="preView()">
</p>
<style media=print>
.Noprint{display:none;}
</style>
<script language="JavaScript">
function dayin(){window.print()}
function dayin1(){try{document.all.WebBrowser.ExecWB(6,6)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function pageSetup(){try{document.all.WebBrowser.ExecWB(8,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
function preView(){try{document.all.WebBrowser.ExecWB(7,1)}catch(e){alert("您的浏览器不支持此功能,需要5.5以上版本")}}
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<p>页面打印测试</p>
<p><span class="Noprint">测试1:
<input type=button value=打印 onclick="window.print()">
<INPUT type=button value=打印 onclick="document.execCommand('Print')">
</span>
</p>
<p class="Noprint">测试2:
<input class="Noprint" type=button value=打印 onclick="dayin()">
<input class="Noprint" type=button value=直接打印 onclick="dayin1()">
<input class="Noprint" type=button value=页面设置 onclick="pageSetup()">
<input class="Noprint" type=button value=打印预览 onclick="preView()">
</p>
首先在网页中添加:
<OBJECT id="WebBrowser" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
VIEWASTEXT>
</OBJECT>
然后就可以依次加入功能按钮了:
<input onclick="document.all.WebBrowser.ExecWB(6,1)" type="button" value="打印"> <input onclick="document.all.WebBrowser.ExecWB(6,6)" type="button" value="直接打印">
<input onclick="document.all.WebBrowser.ExecWB(8,1)" type="button" value="页面设置">
<input onclick="document.all.WebBrowser.ExecWB(7,1)" type="button" value="打印预览"> <INPUT type="button" value="关闭窗口" onclick="javascript:window.close()">
将这两块东西放到<center class=noprint></center>就不会打印这些按钮了。当然要定义noprint了:
<style media="print">.Noprint { DISPLAY: none }</style>只要把不想打印的东西的css设置成noprint就可以了。
现在就实现了基本的web打印,需要注意的情况如下:
必须将ie的internet选项的安全设置中对于没有标记为安全的ActiveX控件进行...设置成提示或者启用,否则会报错,导致不可用。
如果在vs.net编辑环境下编辑该页面,它经常自动的给object添加多余的参数,有了这些东西,打印就会出错,所以要记得最后保存的时候删除它们。
为了简便并且达到最好的效果,我们可以在一个页面实现编辑和打印,这时候会需要很多的textbox,我们把它的css设置成.edittext
{
overflow-y:visible;
width: 100%;
border-top: none;
border-right: none;
border-bottom: none;
border-left: none;
}就可以实现在打印的时候不显示边框和multiline的textbox不显示滚动条了。
还有一些小经验就是在设置标格宽度的时候,对于A4纸张,横打用920,竖打用640,效果最好。
用CSS实现表格单元格数据自动换行或不换行
用CSS实现表格单元格数据自动换行或不换行
1、自动换行:
<style type="text/css">
.AutoNewline
{
word-break: break-all;/*必须*/
}
</style>
<table>
<tr>
<td class="AutoNewline">自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行自动换行</td>
</tr>
</table>
2、不换行:
<style type="text/css">
.NoNewline
{
word-break: keep-all;/*必须*/
}
</style>
<table>
<tr>
<td class="NoNewline">不换行不换行不换行不换行不换行不换行不换行不换行不换行不换行</td>
</tr>
</table>
- js WebBrowser 打印 套打
- web打印、套打
- web打印+套打问题
- 关于打印(c#套打...)
- 后台打印(套打1)
- jsp实现套打(发票打印)
- java实现打印套打功能
- Web、winform打印、批量打印解决方案、excel套打模板
- js实现WEB套打程序
- js实现web套打功能,支持拖动布局,支持按键移动支持打印预览,结果可保存至数据库中
- 套打
- 套打
- 使用IE自带的打印控件进行套打
- MultiRow发现之旅(七)- 套打和打印
- ASP.NET 实现快递单的打印及套打
- 使用IE自带的打印控件进行套打
- 批量套打 打印部分代码 winform 版
- lodop页面直接打印 水印 分页 套打
- 解读价值观
- LPTSTR、LPCSTR、LPCTSTR、LPSTR的来源及意义和转换
- JavaScript应放在页面的什么地方
- 后悔生气
- JS验证框架xValidate 7.01(20090830)
- js WebBrowser 打印 套打
- TeeChart.v8.01安装
- 转:《深入理解LINUX内核》中文第三版明显的错误
- 翻译
- powerpoint中使幻灯片连续播放
- hibernateTemplate方法总结
- 2009 8 .30
- SSH错误:java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String
- RedHat糸列Mysql-5.0.45的安装(转自ghan.cublog.cn 作者ghan)