我正在使用FileSaver.js库和WordExport.js使用 JavaScript、jQuery 导出 word 文档,一切正常,但页边距不起作用,我尝试了多种方法但无法成功,这里是编码。以下 div 将被导出
<div class="col-md-12" id="page-content">
<style type="text/css">
@page {
mso-page-orientation: portrait;
size: 21cm 29.7cm;
margin: 1cm 1cm 1cm 1cm;
}
@page Section1 {
mso-header-margin: .2in;
mso-footer-margin: .5in;
mso-header: h1;
mso-footer: f1;
}
div.Section1 {
page: Section1;
}
</style>
<div class="firstpage Section1" style="margin:10.0pt 20.0pt 10.0pt 20.0pt; !important">
<h2>Topic of template</h2>
<h5>Prepared for</h5>
<h5>Name of Company</h5>
<br clear=all style='mso-special-character:line-break; page-break-before:always'>
</div>
<br clear=all style='page-break-before:always; mso-break-type:section-break'>
<div class="otherpages">
<p>other pages stuff</p>
</div>
</div>
提前致谢。