<html>   
  <head>   
  <meta   name=vs_targetSchema   content="http://schemas.microsoft.com/intellisense/ie5">   
  <title>***上海市眼病防治中心病人结帐费用报表***</title>   
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
  <!--media=print   这个属性可以在打印时有效-->   
  <style   media=print>   
  .Noprint{display:none;}   
  .PageNext{page-break-after:   always;}   
  </style>   
  <style>   
  body,td,th     
  {   
  font-size:   12px;   
  }   
  .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;   
    
  border-collapse:collapse;   
  }   
  .NOPRINT   {   
  font-family:   "宋体";   
  font-size:   12px;   
  }   
    
  </style>   
     </head>   
    
  <body   >   
      <OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0 VIEWASTEXT> </OBJECT>   
  <input   type=button   value=打印           onclick="document.all.WebBrowser.ExecWB(6,1)"   class="NOPRINT">   
  <input   type=button   value=直接打印   onclick="document.all.WebBrowser.ExecWB(6,6)"   class="NOPRINT">   
  <input   type=button   value=页面设置   onclick="document.all.WebBrowser.ExecWB(8,1)"   class="NOPRINT">   
  <input   type=button   value=打印预览   onclick="document.all.WebBrowser.ExecWB(7,1)"   class="NOPRINT">   
      <br/>   
  <table   width="90%"   border="0"   align="center"   cellpadding="0"   cellspacing="0">   
      <tr   align="center">     
          <td   colspan="5"><font   size="3">上海市眼病防治中心病人结帐费用报表(A)   </font></td>   
      </tr>   
      <tr>     
          <td>汇总人次   5</td>   
          <td>费用合计   15853.12</td>   
          <td>统计日期   </td>   
          <td>制表人   023</td>   
          <td>制表日期:2004-05-13</td>   
      </tr>   
  </table>   
    
    
    
  <table   width="90%"   border="1"   align="center"   cellpadding="2"   cellspacing="0"   bordercolor="#000000"     class="tabp">   
      <tr>     
          <td       >姓名</td>   
          <td       >住院号</td>   
          <td       >科室</td>   
          <td       >结帐日期</td>   
          <td       >出院日期</td>   
          <td       >费用合计</td>   
          <td       >医保交易费用</td>   
          <td       >分类给付费用</td>   
          <td       >非医保交易费</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
    
      </tr>   
      <tr>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
          <td       >&nbsp;</td>   
    
      </tr>   
  </table>   
  <hr   align="center"   width="90%"   size="1"   noshade   class="NOPRINT"   >   
  <!--分页-->   
  <div   class="PageNext"></div>   
  <table   width="90%"   border="1"   align="center"   cellpadding="2"   cellspacing="0"   bordercolor="#000000"     class="tabp">   
      <tr>   
          <td   >第2页</td>   
      </tr>   
      <tr>   
          <td   >看到分页了吧</td>   
      </tr>   
      <tr>   
          <td   >&nbsp;</td>   
      </tr>   
      <tr>   
          <td   >&nbsp;</td>   
      </tr>   
      <tr>   
          <td   ><table   width="100%"     border="0"   cellspacing="0"   cellpadding="0">   
                  <tr>   
                      <td   width="50%"   >这样的报表   
                              对一般的要求就够了。</td>   
                      <td>&nbsp;</td>   
                  </tr>   
          </table></td>   
      </tr>   
  </table>   
  
  <table width="780%" border="1"  class="Noprint">
  <tr>
    <td>能不能打印</td>
  </tr>
</table>  </body>   
  </html>

解决方案 »

  1.   

    <style media=print> 
    .Noprint{display:none;} 
    .PageNext{page-break-after:always;} 
    </style>
      

  2.   

    TO xuStanly(黑金)
      请不要捣乱,谢谢。
      

  3.   

    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) 关闭窗体无提示 不知道还有没有其他的可选项。
      

  4.   

    试试:
    A:
    1:直接打开要打印的框架页面;
    2:打印打开的页面;

    B:
    1:选中要打印的内容;
    2:取得要找印的HTML代码;
    3:打开一个新的页面;
    4:前取得的HTML代码追加至打开的新页面;
    5:打印新的页面;两种方法类似,都是放到一个新的页面去打印,第一种来的简单些;
      

  5.   

    还有一种更bt的方法是
    打印框价页的是时候,用javascript改变框价的形状再进行打印,然后在变回来.
      

  6.   

    看看我的方法吧,关闭打印预览的同时新开的WINDOW也会关闭。
    function printbill(){
      var odoc=window.document; 
      var r=odoc.body.createTextRange(); 
      var stxt=r.htmlText; 
    stxt.replace("absolute","")
      var pwin=window.open("","print","toolbar=0,scrollbars=1,resizable=1,height=450,width=600,top=0,left=0"); 
    pwin.document.write("<html><head><style type='text/css'><!--.noborder { border-style: solid; border-width: 0px; padding: 0; font-size:13px; font-Family:;color:#5D5D5D; }--></style>")
    pwin.document.write("<style media='print'>.Noprint { DISPLAY: none }</style>")
    pwin.document.write("</head><body>")
    // pwin.document.write("<OBJECT id='WebBrowser' height='0' width='0' classid='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2' VIEWASTEXT></OBJECT>");
      pwin.document.write(stxt);
    // if(pwin.document.WebBrowser)pwin.document.WebBrowser.ExecWB(6,1);else pwin.print();
    pwin.document.close()
    pwin.print();
    pwin.close();
    }不弹出新窗口也可以实现
    <input type="button" value="打印" onclick="printtb()">
    <script>
    function printtb(){
    var abc=document.body.innerHTML;
    document.body.innerHTML=window.iframe1.document.body.innerHTML;
    window.print();
    document.body.innerHTML=abc;
    }
    </script>