请高手帮忙。

解决方案 »

  1.   

    不能用报表制作Gridview吗自带打印功能
      

  2.   


    1.定义一个 样式
    <style>
    @media Print { .Noprn{Display:none}}
    </style>
    把不需要打印的元素 class设置成 Noprn
    <p class="Noprn">不打印</p>
    =======================================
    2.js代码
    <script>
      function printview()
    {
        bdhtml=window.document.body.innerHTML;
        sprnstr="<!--本部分以上不被打印-->";
        eprnstr="<!--本部分以下不被打印-->";
        prnhtml=dbhtml.substr(dbhtml.indexof(sprnstr)+17);
        prnhtml=prnhtml.substring(0,prnhtml.indexof(eprnstr));
        window.document.body.innerHTML=prnhtml;
        window.print();
    }
    </script>
    页面代码
    <center><!--本部分以上不被打印--></center>
    12312321323
    <center><!--本部分以下不被打印--></center><input type="button" name="print" value="预览并打印" onclick="printview()"/>
      

  3.   

    webbrower打印 
    直接打印window.print() 
    调用Office实现导出到excel、WORD,实现WEB打印 
    利用第三方控件实现打印如 导出PDF 
    打印部分内容
    function doPrint() {   
    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();   
    }