頁面打印js方法

<#import "/WEB-INF/shtml/framework/until/common.ftl" as common>javascript

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">css

<html>html

  <head>java

    

    <title>打印頁面</title>ajax

    <#include "/WEB-INF/shtml/framework/ini/header.shtml"> spa

    <script type='text/javascript' src='${common.contentPath}/ajax/util.js'></script>.net

<style media="print" type="text/css"> orm

.tab{display:none;} htm

.PageNext{page-break-after: always;}ip

.tabPrint td

height:5px; 

listTab{ background-color:#fff; margin:10px 3px 3px 0px; border:1px #333 solid; border-collapse:collapse; font-size:12px; }

.listTab th{height:54px; border:1px #333 solid;  font-weight:normal; line-height:24px; white-space:nowrap; padding:4px;}

.listTab td{ height:54px;border:1px #333 solid; padding:0 10px 0 10px; border-collapse:collapse;}

big{ font-size:14px; padding:5px; font-weight:bold;}

</style> 

<style media="screen">

.listTab{ background-color:#fff; margin:10px 3px 3px 0px; border:1px #333 solid; border-collapse:collapse; font-size:12px; }

.listTab th{height:54px; border:1px #333 solid;  font-weight:normal; line-height:24px; white-space:nowrap; padding:4px;}

.listTab td{ height:54px;border:1px #333 solid; padding:0 10px 0 10px; border-collapse:collapse;}

big{ font-size:14px; padding:5px; font-weight:bold;}

</style>

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->

<%

List tagsList = (List) request.getAttribute("newTagsList");

%>

  </head>

  <script type="text/javascript">

  var HKEY_Root,HKEY_Path,HKEY_Key;

HKEY_Root="HKEY_CURRENT_USER";

HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";

function print(){

var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 

SetupPage();

//SetupLandscape();

WebBrowser1.ExecWB(7,1);

//打印

    //WebBrowser1.ExecWB(6,6);

//WebBrowser.execwb(6,6);

//alert("1111");

}

//設置紙張方向 

function SetupLandscape() 

    try{ 

  var wsShell= new ActiveXObject("WScript.Shell"); 

  //打印頁面的Menubar必須可見,此操做相似按鍵盤上的Alt+F+U也就是 調出頁面設置對話框 

  wsShell.sendKeys('%fu'); 

  //此操做相似按鍵盤上的Alt+A也就是 設置橫向打印 

  wsShell.sendKeys('%a'); 

  //此操做相似按鍵盤上的回車 頁面設置對話框的默認焦點在 肯定上 因此直接肯定 

  wsShell.sendKeys('{ENTER}'); 

     

      catch(e){} 

//設置頁面的頁眉和頁腳

function SetupPage() 

      try{ 

    var Wsh=new ActiveXObject("WScript.Shell"); 

      HKEY_Key="header"; 

      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); 

      HKEY_Key="footer"; 

      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"制單:&b&b共&P頁,第&p頁"); 

      HKEY_Key="margin_bottom"; 

      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.39"); 

      HKEY_Key="margin_left"; 

      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.39"); 

      HKEY_Key="margin_right"; 

      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.39"); 

      HKEY_Key="margin_top"; 

      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.39"); 

     

      catch(e){} 

  </script>

  <body>

    <input  type="button" class="tab"  id = "tab" name = "tab" value="打印預覽" onclick="print();">

<div style="display:block">

<table  border="0" cellspacing="0" cellpadding="0"  width=100%  class="listTab">

<!--<tr>

<td colspan="6" align="center"><b><h3>廣州市社會保障(市民)卡交接清單</h3></b></td>

</tr>

<tr>

<td>客戶名稱</td>

<td colspan="5">廣州市市民服務和社會保障卡管理中心 </td>

</tr>

<tr>

<td width="18%">交接日期</td>

<td>${common.formateDate(req_af.transferdate,"yyyy-MM-dd")}</td>

<td width="10%">交接批次</td>

<td>${common.formateDate(req_af.transferdate,"yyyy-MM-dd")}</td>

<td>本批次數量</td>

<td>${req_af.bitchnum}</td>

</tr>

<tr>

<td>卡片名稱  <br />

(卡種類型)</td>

<td colspan="5">廣州社保金融卡</td>

</tr>

<tr>

<td>區名稱及代碼</td>

<td colspan="5">天河區     440107</td>

</tr>

<tr >

<td rowspan="3">全業務服務網點</td>

</tr>

<tr>

<td colspan="2">平常業務服務網點</td>

</tr>

<tr>

<td>名稱</td>

<td>箱數</td>

</tr>

<tr>

<td rowspan="3">全業務服務網點名稱-箱號</td>

</tr>

<tr>

<td >天河區級管理  4401070505</td>

<td > 穗園網點  050544</td>

<td > 2</td>

</tr>

<#if binlist?size gt 0>

<tr>

<td align="center" width="15%">箱號</td>

<td align="center" width="15%" >數量</td>

<td align="center" width="15%">盒號</td>

<td align="center" width="15%">數量</td>

<td align="center">備註</td>

<td align="center"></td>

</tr>

<#list boxlist as listbox>

<tr>

<td rowspan="${boxlist[listbox_index].boxvo?size+1}" align="center">${listbox.binno}</td>

<td rowspan="${boxlist[listbox_index].boxvo?size+1}" align="center">${listbox.allnum}</td>

</tr>

<#list boxlist[listbox_index].boxvo as boxvo>

<tr>

<td align="center">${boxvo.boxno}</td>

<td align="center">${boxvo.storagecount}</td>

<td align="center">${boxvo.remark}</td>

</tr>

</#list>  

</#list>

</#if>

 

--><!-- 

<tr>

<td align="center" width="15%">箱號</td>

<td align="center" width="15%" >數量</td>

<td align="center" width="15%">盒號</td>

<td align="center" width="15%">數量</td>

<td align="center">備註</td>

</tr>

<tr>

<td rowspan="3" align="center">10001</td>

<td rowspan="3" align="center">300</td>

<td align="center">HSJRK1000101</td>

<td align="center">100</td>

<td align="center">&nbsp;</td>

</tr>

<tr>

<td align="center">HSJRK1000102</td>

<td align="center">100</td>

<td align="center">&nbsp;</td>

</tr>

<tr>

<td align="center">HSJRK1000103</td>

<td align="center">100</td>

<td align="center">&nbsp;</td>

</tr>

<tr>

<td rowspan="3" align="center">10002</td>

<td rowspan="3" align="center">300</td>

<td align="center">HSJRK1000202</td>

<td align="center">100</td>

<td align="center">&nbsp;</td>

</tr>

<tr>

<td align="center">HSJRK1000202</td>

<td align="center">100</td>

<td align="center">&nbsp;</td>

</tr>

<tr>

<td align="center">HSJRK1000202</td>

<td align="center">100</td>

<td align="center">&nbsp;</td>

</tr>

   --> 

   <tr>

    <td colspan="5" align="center"><b><h3>廣州市社會保障(市民)卡交接清單</h3></b></td>

   </tr>

   <tr>

    <td>客戶名稱</td>

<td colspan="4">廣州市市民服務和社會保障卡管理中心 </td>

   </tr>

   <tr>

    <td width="18%">交接日期</td>

<td>${common.formateDate(req_af.transferdate,"yyyy-MM-dd")}</td>

<td width="10%">交接批次</td>

<td>&nbsp;</td>

<td>本批次數量: ${req_af.bitchnum}</td>

   </tr>

   <tr>

    <td>卡片名稱  <br />

(卡種類型)</td>

<td colspan="4">廣州社保金融卡</td>

   </tr>

   <tr>

    <td>區名稱及代碼</td>

<td colspan="4">${req_af.regional}</td>

   </tr>

   <tr>

    <td rowspan="2">全業務服務網點</td>

    <td colspan="2">平常業務服務網點</td>

    <td rowspan="2">全服務網點名稱-箱號</td>

    <td rowspan="2">平常業務服務網點的卡數量</td>

   

   </tr>

    <tr>

    <td>名稱</td>

    <td>箱數</td>>

   </tr>

  

   <tr>

    <td rowspan="${binlist?size+1}"></td>

    <td rowspan="${binlist?size+1}">${req_af.net_name}</td>

    <td rowspan="${binlist?size+1}">${binlist?size}</td>

   </tr>

    <#if binlist?size gt 0>

   <#list boxlist as listbox>

<tr>

<td align="center" width="15%">${listbox.binno}</td>

<td align="center" width="15%" >${listbox.allnum}</td>

</tr>

</#list>

</#if>

   

<tr>

<td>小計:</td>

<td align="center">&nbsp;</td>

<td align="center">&nbsp;</td>

<td align="center">&nbsp;</td>

<td align="center">${req_af.bitchnum}</td>

</tr>

<tr>

<td>備註:</td>

<td colspan="4">&nbsp;</td>

</tr>

</table>

<br>

<br>

<br>

<table width=100%  cellspacing="0" cellpadding="0" class='tabPrint' align="center">

<tr>

<td aligh="left"></td><td></td><td aligh="right"></td>

</tr>

</table>

</div>

  </body>

</html>

相關文章
相關標籤/搜索