当前位置: 代码迷 >> ASP.NET >> 信息显示在页面上并且打印出来,该怎么做
  详细解决方案

信息显示在页面上并且打印出来,该怎么做

热度:2671   发布时间:2013-02-25 00:00:00.0
信息显示在页面上并且打印出来,该如何做?
如题。页面是用VS2005做的。
信息是从数据库中取得的,在页面上用表格形式显示。打印时只需要打印这个表格,并不用打印整个页面。

------解决方案--------------------------------------------------------
水晶报表啊~~~
vs2005自带的,只需注册一下就可以~
我刚用水晶报表处理了一个项目。远程打印合同的问题
------解决方案--------------------------------------------------------
JScript code
<script language="javascript" type ="text/javascript">        function preview()        {        bdhtml=window.document.body.innerHTML;        sprnstr="<!--startprint-->";        eprnstr="<!--endprint-->";        prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));        window.document.body.innerHTML=prnhtml;        window.print();        }        function winClose()        {         window.close();        }        </script>
------解决方案--------------------------------------------------------
JScript code
----------------------------------------
<script language="javascript">
<!--
function PrintNote()
{
var PrintWin=window.open('about:blank','Print');
PrintWin.document.write('<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>' + document.all("PrintContent").innerHTML);
PrintWin.document.all.WebBrowser.ExecWB(7,1);
PrintWin.close();
}
-->
</script>
--------------------------------------------
内容用<div>装起来,并把DIV设置ID
<div id="PrintContent" align="center">
your GridView
</div>

把gridvie控件放入DIV里就可以实现打印了。
------解决方案--------------------------------------------------------
探讨
JScript code

<script language="javascript" type ="text/javascript">
function preview()
{
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=pr…
  相关解决方案