首页 > 代码库 > web打印

web打印

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ServiceOut_Print.aspx.cs"
Inherits="weirManagement.TaskM.ServiceOut_Print" %>

<%--<%@ Register Src="http://www.mamicode.com/ServiceOutInfo_view.ascx" TagName="ServiceOutInfo_view" TagPrefix="uc4" %>--%>
<!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>
<link href="http://www.mamicode.com/css/style.default.css" rel="stylesheet" type="text/css" />
<script src="http://www.mamicode.com/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
var hkey_root, hkey_path, hkey_key
hkey_root = "HKEY_CURRENT_USER"
hkey_path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\"
//设置网页打印的页眉页脚为空
function pagesetup_null() {
try {
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key = "header";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
hkey_key = "footer";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
hkey_key = "margin_bottom";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0");
hkey_key = "margin_left";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.1");
hkey_key = "margin_right";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.1");
hkey_key = "margin_top";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.4");
} catch (e) { }
}
//设置网页打印的页眉页脚为默认值
function pagesetup_default() {
try {
var RegWsh = new ActiveXObject("WScript.Shell")
hkey_key = "header"
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "&w&b页码,&p/&P")
hkey_key = "footer"
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "&u&b&d")
} catch (e) { }
}
$(function () {
printfunction();
})
function printfunction() {
pagesetup_null();
window.print();
// if (isIE()) {
// WebBrowser.ExecWB(7, 1);
// } else {
// window.print();
// }
}

function printfunction2() {
pagesetup_null();
if (isIE()) {
WebBrowser.ExecWB(7, 1);
} else {
window.print();
}
}

function isIE() {
if (!!window.ActiveXObject || "ActiveXObject" in window)
return true;
else
return false;
}
</script>
<style media="print" type="text/css">
.noprint
{
display: none;
width: 0px;
height: 0px;
}
h4
{
border: 2px solid #0866c6;
background: #0866c6;
}
input
{
color: #000000;
}
.table .table-bordered
{
border-top: 1px solid #dddddd;
}
thead tr th
{
border-bottom: 1px solid #dddddd;
border-right: 1px solid #dddddd;
}
</style>
</head>
<body>
<object id="WebBrowser" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<form id="form1" runat="server" class="stdform">
<div>
<div class="maincontent">
<div class="maincontentinner">

<h4 class="widgettitle"><%--服务出差申请单--%><%=Resources.global1.service_trip%></h4>
<div class="widgetcontent">

<table class="table table-bordered">
<tr>
<td colspan="4" style="border:1px #CCC solid; ">
<div>
<input type="hidden" id="taskid" value="http://www.mamicode.com/" />
<input type="hidden" id="demandid" value="http://www.mamicode.com/" />
<div style=" float:left">

<div class="pageicon"><span class="iconfa-briefcase"></span></div>


</div>
<div style=" float:right"><img src="http://www.mamicode.com/images/logo3.jpg" width="107" height="80" style=" float:right" /></div>
</div>
</td>
</tr>
<tr>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"><%=Resources.global1.service_engineer%></div>
<div style=" height:40px; line-height:30px;"><%=Resources.global1.service_no%></div>
<div style=" height:40px; line-height:30px;"><%=Resources.global1.serverType%></div>
</td>
<td style="background-color:#FFF">
<div style=" height:40px"><input type="text" id="serviceP" class="span3" value="" runat="server"/></div>
<div style=" height:40px"><input type="text" id="serviceNo" class="span3" value="" runat="server"/></div>
<div style=" height:40px">
<select name="serviceType" id="serviceType" class="uniformselect span3" runat="server">
</select>
</div>
</td>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"><%=Resources.global1.apply_date%></div>
<div style=" height:40px; line-height:30px;"><%=Resources.global1.service_area%></div>
<div style=" height:40px; line-height:30px;"><%=Resources.global1.sale_engineer%></div>
</td>
<td style="background-color:#FFF">
<div style=" height:40px"><input type="text" id="applyDate" class="span3" value="" runat="server"/></div>
<div style=" height:40px"><input type="text" id="serviceArea" class="span3" value="" runat="server"/></div>
<div style=" height:40px"><input type="text" id="saleP" class="span3" value="" runat="server"/></div>
</td>
</tr>
<tr>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"><%=Resources.global1.plan_departure_time%></div>
<div style=" height:40px; line-height:30px;"><%=Resources.global1.departure_Address%></div>

</td>
<td style="background-color:#FFF">
<div style=" height:40px">
<input type="text" id="planStartT" name="date" runat="server" class="span3" />
<%-- <%=tripInfo==null?"":"disabled" %> value="http://www.mamicode.com/"--%>
</div>
<div style=" height:40px">
<select name="departureAdd" id="departureAdd" runat="server" class="span3" >
</select></div>
</td>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"><%=Resources.global1.plan_reutrn_time%></div>
<div style=" height:40px; line-height:30px;"><%=Resources.global1.return_to%></div>

</td>
<td style="background-color:#FFF">
<div style=" height:40px">
<input type="text" id="planReturnT" name="date" runat="server" class="span3" />
</div>
<div style=" height:40px">
<select name="returnAdd" id="returnAdd" runat="server" class="span3" >
</select></div>
</td>
</tr>
<tr>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"></div>
<div style=" height:40px; line-height:30px;"></div>
<div style=" height:40px; line-height:30px;"></div>
</td>
<td style="background-color:#FFF" colspan="3">
<div style=" height:40px"><input type="text" id="clientName" runat="server" class="span3" value=""/></div>
<div style=" height:40px"><input type="text" id="detailAdd" runat="server" class="span3" value=""/></div>
<div style=" height:40px">
<input type="text" id="trafficDes" runat="server" class="span8" />
</div>
</td>
</tr>
<tr>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"></div>
<div style=" height:40px; line-height:30px;"></div>
<div style=" height:40px; line-height:30px;"></div>
</td>
<td style="background-color:#FFF">
<div style=" height:40px"><input type="text" id="mainContacter" runat="server" class="span3" value=""/></div>
<div style=" height:40px"><input type="text" id="position" runat="server" class="span3" value=""/></div>
<%--<div style=" height:40px"><input type="text" id="mobile" runat="server" class="span3" value=""/></div>--%>
<div style=" height:40px"><input type="text" id="email" runat="server" class="span3" value=""/></div>
</td>
<td style="background-color:#FCFCFC">
<div style=" height:40px; line-height:30px;"></div>

<div style=" height:40px; line-height:30px;"></div>
<div style=" height:40px; line-height:30px;"></div>
</td>
<td style="background-color:#FFF">
<div style=" height:40px"></div>
<div style=" height:40px"><input type="text" id="tel" runat="server" class="span3" value=""/></div>
<div style=" height:40px"><input type="text" id="fax" runat="server" class="span3" value=""/></div>
</td>
</tr>
<tr>
<td colspan="4">
<asp:Repeater ID="Rep_product" runat="server">
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-bordered">
<thead>
<tr>
<th class=" center"></th>
<th class=" center"></th>
<th class=" center"></th>
<th class=" center"></th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tr style=" border:none">
<td class=" center"></td>
<td class=" center"></td>
<td class=" center"></td>
<td class=" center"></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</td>
</tr>
<tr>
<td colspan="1" style="background-color:#FCFCFC">
</td>
<td colspan="3" style=" background-color:#FFF;">
<textarea id="serviceTrip_objective" runat="server" cols="80" rows="5" class="span8"> </textarea>

</td>
</tr>
</table>
</div>
</div>
<div class="noprint">
<div align="center">
<a id="A2" href="javascript:void(0)" class="btn btn-primary btn-rounded"
style="padding: 5px 35px;" onclick="windowprint()">
<%=Resources.global1.print%></a>
<a id="printalink" href="javascript:void(0)" class="btn btn-primary btn-rounded"
style="padding: 5px 35px;" onclick="printfunction()">
<%=Resources.global1.print%></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a id="A1" href="javascript:void(0)" class="btn btn-primary btn-rounded"
style="padding: 5px 35px;" onclick="printfunction2()">
<%=Resources.global1.print1%></a>
<a href="http://www.mamicode.com/help/help.html" target="_blank"><%=Resources.global1.print_preview_fail%></a>
</div>
</div>
<!--maincontentinner-->
</div>
<!--maincontent-->
</div>
<!-- Modal -->
</form>
</body>
</html>

web打印