52 lines
1.7 KiB
Plaintext
52 lines
1.7 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="admin_printpw_index" %>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head runat="server">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
<title>列印文件</title>
|
|
<script src="https://code.jquery.com/jquery-3.6.2.min.js"></script>
|
|
<link rel="stylesheet" href="print.css?v=202412061514" />
|
|
</head>
|
|
<body>
|
|
<style>
|
|
@media print {
|
|
.page-break {
|
|
page-break-before: always;
|
|
}
|
|
}
|
|
</style>
|
|
<form id="form1" runat="server">
|
|
<div class="pages">
|
|
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
|
|
<ItemTemplate>
|
|
<asp:Literal ID="word" runat="server"></asp:Literal>
|
|
</ItemTemplate>
|
|
</asp:Repeater>
|
|
</div>
|
|
</form>
|
|
<script src="print.js?v=202412061514"></script>
|
|
<script type="text/javascript">
|
|
window.onload = function () {
|
|
//$(".mid_text").each(function(i,t){console.log($(t).html().replace("<br>",""))});
|
|
//檢查C#:不要多一個<br>
|
|
var items=document.querySelectorAll(".mid_text");
|
|
items.forEach((t,i)=>{
|
|
//console.log(t);
|
|
var s1=t.innerHTML.replace("<br>","");
|
|
var s2=t.style.cssText.replace("--lines: 2","--lines:1");
|
|
//t.innerHTML=s1;
|
|
//t.style=s2;
|
|
});
|
|
|
|
//window.print();
|
|
//setTimeout(function () { window.close(); }, 1);
|
|
setTimeout(() => {
|
|
window.print();
|
|
}, 500);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|