JS打印表格(HTML定义格式)

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link rel=File-List href="工作日志.files/filelist.xml">
<style id="环境调查_11939_Styles">
table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
.font511939
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;}
.xl6311939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
border:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl6411939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl6511939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
border-top:.5pt solid windowtext;
border-right:none;
border-bottom:none;
border-left:none;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl6611939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
border-top:.5pt solid windowtext;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl6711939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
border-top:.5pt solid windowtext;
border-right:.5pt solid windowtext;
border-bottom:.5pt solid windowtext;
border-left:none;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl6811939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:22.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
border-top:none;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:none;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
.xl6911939
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:center;
vertical-align:middle;
border-top:.5pt solid windowtext;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:none;
mso-background-source:auto;
mso-pattern:auto;
white-space:normal;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;}

</style>

<script src="http://www.cnblogs.com/js/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
writeData(window.opener.msg);

function writeData(data) {
var operationType = "PrintData";
var utilUrl = "ExpelManageUtil.aspx";
var pdata = "operationType=" + operationType + "&id=" + data;
$.ajax({
url: utilUrl, //后台处理类
type: "POST",
data: pdata,
dataType: "json",
timeout: 1000,
error: function(data) { alert("出现错误或者您没有权限!"); },
success: function(data) {
var b = document.body.innerHTML;
for (var elem in data) {//遍历data中的每一个属性及属性值
b = b.replace("$" + elem, data[elem]);
}
document.body.innerHTML = b;

window.print(); //打印本页
}
});

}
</script>

</head>

<body>
<!--[if !excel]>  <![endif]-->
<!--下列信息由 Microsoft Office Excel 的“发布为网页”向导生成。-->
<!--如果同一条目从 Excel 中重新发布,则所有位于 DIV 标记之间的信息均将被替换。-->
<!--“从 EXCEL 发布网页”向导开始-->

<div id="环境调查_11939" align=center x:publishsource="Excel">

<table x:str border=0 cellpadding=0 cellspacing=0 width=871 class="xl6411939"
style='border-collapse:collapse;table-layout:fixed;width:655pt'>
<col class="xl6411939" width=42 style='mso-width-source:userset;mso-width-alt: 1344;width:32pt'>
<col class="xl6411939" width=72 style='width:54pt'>
<col class="xl6411939" width=42 style='mso-width-source:userset;mso-width-alt: 1344;width:32pt'>
<col class="xl6411939" width=60 style='mso-width-source:userset;mso-width-alt: 1920;width:45pt'>
<col class="xl6411939" width=64 style='mso-width-source:userset;mso-width-alt: 2048;width:48pt'>
<col class="xl6411939" width=72 style='width:54pt'>
<col class="xl6411939" width=55 style='mso-width-source:userset;mso-width-alt: 1760;width:41pt'>
<col class="xl6411939" width=61 style='mso-width-source:userset;mso-width-alt: 1952;width:46pt'>
<col class="xl6411939" width=42 style='mso-width-source:userset;mso-width-alt: 1344;width:32pt'>
<col class="xl6411939" width=72 style='width:54pt'>
<col class="xl6411939" width=38 style='mso-width-source:userset;mso-width-alt: 1216;width:29pt'>
<col class="xl6411939" width=72 style='width:54pt'>
<col class="xl6411939" width=96 style='mso-width-source:userset;mso-width-alt: 3072;width:72pt'>
<col class="xl6411939" width=83 style='mso-width-source:userset;mso-width-alt: 2656;width:62pt'>
<tr height=45 style='mso-height-source:userset;height:33.75pt'>
<td colspan=14 height=45 class="xl6811939" width=871 style='height:33.75pt;width:655pt'> 工 作 日 志</td>
</tr>
<tr height=35 style='mso-height-source:userset;height:26.25pt'>
<td height=35 class="xl6311939" width=42 style='height:26.25pt;border-top:none;width:32pt'>日期</td>
<td colspan=2 class="xl6611939" width=114 style='border-right:.5pt solid black;border-left:none;width:86pt'></td>
<td class="xl6311939" width=60 style='border-top:none;border-left:none;width:45pt'>星期</td>
<td class="xl6311939" width=64 style='border-top:none;border-left:none;width:48pt'></td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none;width:54pt'>天气</td>
<td class="xl6311939" width=55 style='border-top:none;border-left:none;width:41pt'></td>
<td class="xl6311939" width=61 style='border-top:none;border-left:none;width:46pt'>温度(℃)</td>
<td class="xl6311939" width=42 style='border-top:none;border-left:none;width:32pt'></td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none;width:54pt'>风力风向</td>
<td class="xl6311939" width=38 style='border-top:none;border-left:none;width:29pt'></td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none;width:54pt'></td>
<td class="xl6311939" width=96 style='border-top:none;border-left:none;width:72pt'>值班员</td>
<td class="xl6311939" width=83 style='border-top:none;border-left:none;width:62pt'></td>
</tr>
<tr height=29 style='mso-height-source:userset;height:21.75pt'>
<td height=87 class="xl6311939" width=42 style='height:65.25pt;border-top:none;width:32pt'>参加人数(人)</td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none;width:54pt'></td>
<td class="xl6311939" width=42 style='border-top:none;width:32pt'>装备器材</td>
<td colspan=3 class="xl6611939" width=196 style='border-right:.5pt solid black;border-left:none;width:147pt'>$Devices </td>
<td class="xl6311939" width=55 style='border-top:none;width:41pt'>猎枪(支)</td>
<td class="xl6311939" width=61 style='border-top:none;border-left:none; width:46pt'></td>
<td class="xl6311939" width=42 style='border-top:none;width:32pt'>进场时间</td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none; width:54pt'></td>
<td class="xl6311939" width=38 style='border-top:none;width:29pt'>结束时间</td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none; width:54pt'></td>
<td class="xl6311939" width=96 style='border-top:none;width:72pt'>带队干部</td>
<td class="xl6311939" width=83 style='border-top:none;border-left:none; width:62pt'></td>
</tr>

<tr height=52 style='mso-height-source:userset;height:39.0pt'>
<td colspan=2 height=52 class="xl6311939" width=114 style='height:39.0pt;
width:86pt'>消耗子弹(发)</td>
<td colspan=2 class="xl6311939" width=102 style='border-left:none;width:77pt'></td>
<td colspan=3 class="xl6311939" width=191 style='border-left:none;width:143pt'>猎枪消耗子弹(发)</td>
<td colspan=2 class="xl6311939" width=103 style='border-left:none;width:78pt'></td>
<td colspan=2 class="xl6311939" width=110 style='border-left:none;width:83pt'>其他器材消耗</td>
<td colspan=3 class="xl6311939" width=168 style='border-left:none;width:126pt'></td>

</tr>
<tr height=31 style='mso-height-source:userset;height:23.25pt'>
<td colspan=4 height=31 class="xl6311939" width=216 style='height:23.25pt; width:163pt'>环境检查情况及发现问题</td>
<td colspan=3 class="xl6311939" width=191 style='border-left:none;width:143pt'>处理措施</td>
<td colspan=2 class="xl6311939" width=103 style='border-left:none;width:78pt'>工作量</td>
<td colspan=2 class="xl6311939" width=110 style='border-left:none;width:83pt'>器材消耗量</td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none; width:54pt'>工时(时)</td>
<td class="xl6311939" width=96 style='border-top:none;border-left:none; width:72pt'>参加人数(人)</td>
<td class="xl6311939" width=83 style='border-top:none;border-left:none; width:62pt'>带队干部</td>
</tr>
<tr height=65 style='mso-height-source:userset;height:48.75pt'>
<td colspan=4 height=65 class="xl6311939" width=216 style='height:48.75pt; width:163pt'></td>
<td colspan=3 class="xl6311939" width=191 style='border-left:none;width:143pt'></td>
<td colspan=2 class="xl6311939" width=103 style='border-left:none;width:78pt'></td>
<td colspan=2 class="xl6311939" width=110 style='border-left:none;width:83pt'></td>
<td class="xl6311939" width=72 style='border-top:none;border-left:none; width:54pt'></td>
<td class="xl6311939" width=96 style='border-top:none;border-left:none; width:72pt'></td>
<td class="xl6311939" width=83 style='border-top:none;border-left:none; width:62pt'></td>
</tr>
<tr height=95 style='mso-height-source:userset;height:71.25pt'>
<td colspan=2 height=95 class="xl6311939" width=114 style='height:71.25pt; width:86pt'>记<span style='mso-spacerun:yes'> </span>事</td>
<td colspan=12 class="xl6611939" width=757 style='border-right:.5pt solid black; border-left:none;width:569pt'></td>
</tr>
<tr height=95 style='mso-height-source:userset;height:71.25pt'>
<td colspan=2 height=95 class="xl6311939" width=114 style='height:71.25pt; width:86pt'>待办事项</td>
<td colspan=12 class="xl6611939" width=757 style='border-right:.5pt solid black; border-left:none;width:569pt'></td>
</tr>
<tr height=35 style='mso-height-source:userset;height:26.25pt'>
<td colspan=4 height=35 class="xl6511939" width=216 style='height:26.25pt; width:163pt'>填表人:</td>
<td class="xl6411939" width=64 style='width:48pt'></td>
<td colspan=4 class="xl6511939" width=230 style='width:173pt'>交班时间:</td>
<td class="xl6411939" width=72 style='width:54pt'></td>
<td colspan=4 class="xl6511939" width=289 style='width:217pt'>接班人员:</td>
</tr>
<tr height=35 style='mso-height-source:userset;height:26.25pt'>
<td height=35 class="xl6411939" width=42 style='height:26.25pt;width:32pt'></td>
<td class="xl6411939" width=72 style='width:54pt'></td>
<td class="xl6411939" width=42 style='width:32pt'></td>
<td class="xl6411939" width=60 style='width:45pt'></td>
<td class="xl6411939" width=64 style='width:48pt'></td>
<td class="xl6411939" width=72 style='width:54pt'></td>
<td class="xl6411939" width=55 style='width:41pt'></td>
<td class="xl6411939" width=61 style='width:46pt'></td>
<td class="xl6411939" width=42 style='width:32pt'></td>
<td class="xl6411939" width=72 style='width:54pt'></td>
<td class="xl6411939" width=38 style='width:29pt'></td>
<td class="xl6411939" width=72 style='width:54pt'></td>
<td class="xl6411939" width=96 style='width:72pt'></td>
<td class="xl6411939" width=83 style='width:62pt'></td>
</tr>
<tr height=0 style='display:none'>
<td width=42 style='width:32pt'></td>
<td width=72 style='width:54pt'></td>
<td width=42 style='width:32pt'></td>
<td width=60 style='width:45pt'></td>
<td width=64 style='width:48pt'></td>
<td width=72 style='width:54pt'></td>
<td width=55 style='width:41pt'></td>
<td width=61 style='width:46pt'></td>
<td width=42 style='width:32pt'></td>
<td width=72 style='width:54pt'></td>
<td width=38 style='width:29pt'></td>
<td width=72 style='width:54pt'></td>
<td width=96 style='width:72pt'></td>
<td width=83 style='width:62pt'></td>
</tr>
</table>

</div>


<!--“从 EXCEL 发布网页”向导结束-->
</body>

</html>

转载于:https://www.cnblogs.com/jierong12/p/10254229.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值