触摸屏租赁
Touch screen rental
广告机租赁
Advertising rental
机器人租赁
Robot leasing
 当前位置:首页 > > .net web 打印方法

.net web 打印方法
1.设置打印样式
<style>
@media print{
div{display:none}
table{
 background:display:none;
}
}
</style>
2. 调用系统<object id="WebBrowser" classid="ClSID:8856F961-340A-11D0-A96B-00C04Fd705A2" width="0" height="0">
</object>
3.将不打印部分放置在<div></div>中


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="envelop.aspx.cs" Inherits="envelop" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>打印信封</title>
<style>
@media print{
div{display:none}
table{
 background:display:none;
}
}
</style>

 <link href="CSS/style.css" rel="stylesheet"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
<!--
body {
 background-color: #FFFFFF;
}
-->
</style><object id="WebBrowser" classid="ClSID:8856F961-340A-11D0-A96B-00C04Fd705A2" width="0" height="0">
</object>
</head>
<body style="text-align: center">
    <form id="form1" runat="server">
<table width="513" height="287"  border="0" cellpadding="0" cellspacing="0" background="Images/envelop.jpg">
      <tr>
        <td height="33" colspan="4" valign="bottom">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td style="height: 12px; width: 4%;">&nbsp;</td>
                <td style="height: 12px" width="6%">
                    1</td>
              <td width="5%" style="height: 12px">3</td>
              <td width="5%" style="height: 12px">
                  0</td>
              <td width="4%" style="height: 12px">0</td>
              <td style="width: 3%; height: 12px">5</td>
              <td style="width: 8%; height: 12px">
                  1</td>
              <td width="70%" style="height: 12px"></td>
              </tr>
          </table></td>
      </tr>
      <tr>
        <td align="center" style="height: 79px">&nbsp;</td>
        <td colspan="3" valign="bottom" style="height: 79px">
            <asp:TextBox ID="TextBox1" runat="server" Width="206px" style="border-bottom-width: 0px;border-top-width: 0px;border-left-width: 0px;border-right-width: 0px; text-indent:8pt;">长春市东盛大街89号</asp:TextBox></td>
      </tr>
      <tr>
        <td height="26" colspan="4" align="center" valign="bottom">
            <asp:TextBox ID="TextBox2" runat="server" Width="158px" style="border-bottom-width: 0px;border-top-width: 0px;border-left-width: 0px;border-right-width: 0px; text-indent:8pt;">明日科技(收)</asp:TextBox></td>
      </tr>
      <tr>
        <td width="24%" height="31">&nbsp;</td>
        <td width="12%">&nbsp;</td>
        <td colspan="2" valign="bottom">
            <asp:TextBox ID="TextBox3" runat="server" style="border-bottom-width: 0px;border-top-width: 0px;border-left-width: 0px;border-right-width: 0px; text-indent:8pt;">长春市XX街XX号</asp:TextBox></td>
      </tr>
      <tr align="right">
        <td height="115" align="right" valign="bottom">&nbsp;</td>
        <td height="115" align="right" valign="bottom">&nbsp;</td>
        <td width="49%" height="115" align="right" valign="bottom">&nbsp;</td>
        <td width="15%" align="left" valign="bottom">
            <asp:TextBox ID="TextBox4" runat="server" Width="78px" style="border-bottom-width: 0px;border-top-width: 0px;border-left-width: 0px;border-right-width: 0px; text-indent:8pt;">130000</asp:TextBox></td>
      </tr>
      <tr align="right">
        <td colspan="4" valign="bottom"></td>
      </tr>
    </table>
    </form>
 <table width="542" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td height="27"><div align="center"><a href="#" onClick="document.all.WebBrowser.Execwb(7,1)">打印预览</a>
          <a href="#" onClick="document.all.WebBrowser.Execwb(6,1)">打印</a>
          <a href="#" onClick="document.all.WebBrowser.Execwb(6,6)">直接打印</a>
      <a href="#" onClick="document.all.WebBrowser.Execwb(8,1)">页面设置</a></div>
</td>
    </tr>
  </table>
</body>
</html>

 


工作室地址:重庆石桥铺电脑城B座 | 微信:z35544216 | 网址:www.35544216.com