我正在生成“学生信息Word文档”,每页上都有一个动态标题。标头内容是页码,日期,名称,学生编号。每个学生的信息都按“分页符样式”拆分。
CSS“ mso-header”需要与指定的ID标头内容绑定,因此我无法动态绑定标头。例如,将ID为“ h1”而不是h1,h2,h3 ...的mso-header绑定(动态)
<style>
<!-- /* Style Definitions */
p.MsoHeader, li.MsoHeader, div.MsoHeader{
margin:0in;
margin-top:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
}
@page Section1{
size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:1.1in;
mso-title-page:yes;
mso-header:h1;
mso-footer-margin:0.5in;
mso-paper-source:0;
}
div.Section1{
page:Section1;
}
</style>
和内容:
lc_pg_break CONSTANT VARCHAR2(1000) := '<br clear=all style="mso-special-character:line-break;page-break-before:always">';
<div class="Section1">
loop /*loop different student info*/
if count>1 then
htp.p(lc_pg_break);/*when display second student, add page break style */
end if;
<div style="mso-element:header" id="h1" >
<p class="MsoHeader" >
...student info
</p>
</div>
end loop
</div>