有个叫ScriptX的东东,能实现你上面的要求,你去网上下载一个

解决方案 »

  1.   

    <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 defer>
    function window.onload() {
      factory.printing.header = ""
      factory.printing.footer = ""
      factory.printing.portrait = false
      idPrint1.disabled = false; // enable UI button
      idPrint2.disabled = false;
      idPrint3.disabled = false;
      idPrint4.disabled = false;
      idPrint5.disabled = false;
    //  factory.printing.leftMargin = 0.85
    //  factory.printing.topMargin = 0.55
    //  factory.printing.rightMargin = 2.35
    //  factory.printing.bottomMargin = 0.3
      this.focus()
      //factory.printing.PageSetup()
      }
    </script>
    <title>大</title>
    </head>
    <body>
    <div class=noprint>
      <input id="idPrint2" type="button" value="页面设置" onclick="factory.printing.PageSetup()" class=f3>
      <input id="idPrint3" type="button" value="打印预览" onclick="factory.printing.Preview()" class=f3>
      <input id="idPrint1" type="button" value="打印" onclick="factory.printing.Print(false)" class=f3>
      <input id="idPrint4" type="button" onclick="window.close()" value="关闭窗口"  class=f3>
      
    </div>
      

  2.   

    我的做法是使用scriptX和WebBrowser合作使用
    scriptX使用及说明参见http://www.meadroid.com/sx_intro.asp,Basic版免费,下载使用。
    WebBrowser使用方法如下WebBrowser.ExecWB(1,1) 打开Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口Web.ExecWB(4,1) 保存网页Web.ExecWB(6,1) 打印Web.ExecWB(7,1) 打印预览Web.ExecWB(8,1) 打印页面设置Web.ExecWB(10,1) 查看页面属性Web.ExecWB(15,1) 好像是撤销,有待确认Web.ExecWB(17,1) 全选Web.ExecWB(22,1) 刷新Web.ExecWB(45,1) 关闭窗体无提示
      

  3.   

    http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnscrpt/html/dhtmlprint.asphttp://www.meadroid.com/scriptx/docs/printdoc.htm?static
      

  4.   

    <style>
    @media print{
    INPUT {display:none}
    }
    </style>
    <TABLE border="0" style="font-size:9pt;" width="300px" align="center">
    <THEAD style="display:table-header-group;font-weight:bold">
    <TR><TD colspan="2" align="center" style="font-weight:bold;border:3px double red">每页都有的表头</TD></TR>
    </THEAD>
    <TBODY style="text-align:center"">
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR style="page-break-after:always;"><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR style="page-break-after:always;"><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR><TD>表格内容</TD><TD>表格内容</TD></TR>
    <TR style="page-break-after:always;"><TD>表格内容</TD><TD>表格内容</TD></TR>
    </TBODY>
    <TFOOT style="display:table-footer-group;font-weight:bold">
    <TR>
    <TD colspan="2" align="center" style="font-weight:bold;border:3px double blue">每页都有的表尾</TD>
    </TR>
    </TFOOT>
    </TABLE>
    <input type=button value=" 打  印 " onclick="window.print()">