我正在尝试在高级 PDF 的标题中添加一个小表格以获取提货单。这些字段需要出现在每个页面上,以便在页面分离时为交付人员提供帮助。我已经尝试了所有我能想到的方法来让它发挥作用,但是当我测试它时,表格消失了。我是 HTML 新手,所以很难理解问题出在哪里。以下是我正在处理的内容。我尝试将表格放在之前,但这要么会出错,要么会使表格消失。相关表格是下面代码块的末尾,其中包含路线日期、卡车编号和停靠站编号。
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
<#elseif .locale == "ko_KR">
<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
<#elseif .locale == "th_TH">
<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
</#if>
<macrolist>
<macro id="nlheader">
<table class="header" style="width: 100%;"><tr>
<td rowspan="3"><#if companyInformation.logoUrl?length != 0><img src="http://XXXXXXX.shop.netsuite.com/core/media/media.nl?id=11&c=7203566&h=NSaadJ6sqFB7h5yvBSShikbm1V16LLZpMjxRBnK83Udek2SH" style="float: left; margin: 7px; width: 250px; height: 141px;" /> </#if></td>
<td align="right"><span class="title">${record@title}</span></td>
</tr>
<tr>
<td align="right"><span class="number">Sales Order#${record.tranid}</span></td>
</tr>
<tr>
<td align="right">${record.trandate}</td>
</tr></table>
</macro>
<macro id="nlfooter">
<table class="footer" style="width: 100%;"><tr>
<td><barcode codetype="code128" showtext="true" value="${record.tranid}"/></td>
<td align="right"><pagenumber/> of <totalpages/></td>
</tr></table>
</macro>
</macrolist>
<style type="text/css">* {
<#if .locale == "zh_CN">
font-family: NotoSans, NotoSansCJKsc, sans-serif;
<#elseif .locale == "zh_TW">
font-family: NotoSans, NotoSansCJKtc, sans-serif;
<#elseif .locale == "ja_JP">
font-family: NotoSans, NotoSansCJKjp, sans-serif;
<#elseif .locale == "ko_KR">
font-family: NotoSans, NotoSansCJKkr, sans-serif;
<#elseif .locale == "th_TH">
font-family: NotoSans, NotoSansThai, sans-serif;
<#else>
font-family: NotoSans, sans-serif;
</#if>
}
table {
font-size: 9pt;
table-layout: fixed;
}
th {
font-weight: bold;
font-size: 8pt;
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #e3e3e3;
color: #333333;
}
td {
padding: 4px 6px;
}
td p { align:left }
b {
font-weight: bold;
color: #333333;
}
table.header td {
padding: 0;
font-size: 10pt;
}
table.footer td {
padding: 0;
font-size: 8pt;
}
table.itemtable th {
padding-bottom: 10px;
padding-top: 10px;
}
table.body td {
padding-top: 2px;
}
td.addressheader {
font-size: 8pt;
padding-top: 6px;
padding-bottom: 2px;
}
td.address {
padding-top: 0;
}
span.title {
font-size: 28pt;
}
span.number {
font-size: 16pt;
}
span.itemname {
font-weight: bold;
line-height: 150%;
}
hr {
width: 100%;
color: #d3d3d3;
background-color: #d3d3d3;
height: 1px;
}
</style>
</head>
<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
<table style="width: 100%; margin-top: 10px;"><tr>
<td class="addressheader"><b>${record.shipaddress@label}</b></td>
</tr>
<tr>
<td class="address">${record.shipaddress}</td>
</tr></table>
<table border="0" cellpadding="1" cellspacing="1" style="width:100%;">
<thead>
<tr>
<th scope="col">
<p align="center">Route Date</p>
</th>
<th scope="col">
<p align="center">Truck Number</p>
</th>
<th scope="col">
<p align="center">Stop Number</p>
</th>
</tr>
</thead><tr>
<td>
<p align="center">${record.custbody54}</p>
</td>
<td>
<p align="center">${record.custbody53}</p>
</td>
<td>
<p align="center">${record.custbody50}</p>
</td>
</tr></table>
我尝试将代码块移动到块内部,但 from 抛出错误或不显示表格。
您需要在标题内添加表格并调整高度。
我在你的代码中添加了 2 条评论
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
<#elseif .locale == "ko_KR">
<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
<#elseif .locale == "th_TH">
<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
</#if>
<macrolist>
<macro id="nlheader">
<table class="header" style="width: 100%;"><tr>
<td rowspan="3"><#if companyInformation.logoUrl?length != 0><img src="http://XXXXXXX.shop.netsuite.com/core/media/media.nl?id=11&c=7203566&h=NSaadJ6sqFB7h5yvBSShikbm1V16LLZpMjxRBnK83Udek2SH" style="float: left; margin: 7px; width: 250px; height: 141px;" /> </#if></td>
<td align="right"><span class="title">${record@title}</span></td>
</tr>
<tr>
<td align="right"><span class="number">Sales Order#${record.tranid}</span></td>
</tr>
<tr>
<td align="right">${record.trandate}</td>
</tr></table>
<!-- Your table has been moved here, you can remove this comment -->
<table border="0" cellpadding="1" cellspacing="1" style="width:100%;">
<thead>
<tr>
<th scope="col">
<p align="center">Route Date</p>
</th>
<th scope="col">
<p align="center">Truck Number</p>
</th>
<th scope="col">
<p align="center">Stop Number</p>
</th>
</tr>
</thead><tr>
<td>
<p align="center">${record.custbody54}</p>
</td>
<td>
<p align="center">${record.custbody53}</p>
</td>
<td>
<p align="center">${record.custbody50}</p>
</td>
</tr></table>
</macro>
<macro id="nlfooter">
<table class="footer" style="width: 100%;"><tr>
<td><barcode codetype="code128" showtext="true" value="${record.tranid}"/></td>
<td align="right"><pagenumber/> of <totalpages/></td>
</tr></table>
</macro>
</macrolist>
<style type="text/css">* {
<#if .locale == "zh_CN">
font-family: NotoSans, NotoSansCJKsc, sans-serif;
<#elseif .locale == "zh_TW">
font-family: NotoSans, NotoSansCJKtc, sans-serif;
<#elseif .locale == "ja_JP">
font-family: NotoSans, NotoSansCJKjp, sans-serif;
<#elseif .locale == "ko_KR">
font-family: NotoSans, NotoSansCJKkr, sans-serif;
<#elseif .locale == "th_TH">
font-family: NotoSans, NotoSansThai, sans-serif;
<#else>
font-family: NotoSans, sans-serif;
</#if>
}
table {
font-size: 9pt;
table-layout: fixed;
}
th {
font-weight: bold;
font-size: 8pt;
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #e3e3e3;
color: #333333;
}
td {
padding: 4px 6px;
}
td p { align:left }
b {
font-weight: bold;
color: #333333;
}
table.header td {
padding: 0;
font-size: 10pt;
}
table.footer td {
padding: 0;
font-size: 8pt;
}
table.itemtable th {
padding-bottom: 10px;
padding-top: 10px;
}
table.body td {
padding-top: 2px;
}
td.addressheader {
font-size: 8pt;
padding-top: 6px;
padding-bottom: 2px;
}
td.address {
padding-top: 0;
}
span.title {
font-size: 28pt;
}
span.number {
font-size: 16pt;
}
span.itemname {
font-weight: bold;
line-height: 150%;
}
hr {
width: 100%;
color: #d3d3d3;
background-color: #d3d3d3;
height: 1px;
}
</style>
</head>
<!-- Adjust the header height 10% => 20% ?? and remove this comment -->
<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
<table style="width: 100%; margin-top: 10px;"><tr>
<td class="addressheader"><b>${record.shipaddress@label}</b></td>
</tr>
<tr>
<td class="address">${record.shipaddress}</td>
</tr></table>