gpt4 book ai didi

html - Office HTML Word header

转载 作者:太空狗 更新时间:2023-10-29 15:31:03 33 4
gpt4 key购买 nike

我正在生成第一页标题为 HTML 代码的“Word 文档”。 <style>标签包含:

@page Section {
size:8.5in 11.0in;
margin: 0.7in 0.9in 0.7in 0.9in;
mso-header-margin: 0.0in;
mso-footer-margin: 0.0in;
mso-title-page: yes;
mso-first-header: fh1;
mso-paper-source: 0;
}
div.Section {
page: Section;
}

<body> :

<div class="Section" style="font-family: Verdana, sans-serif;">
<![if supportFields]>
<div style="mso-element:header" id="fh1">
<p class="MsoHeader">
header
</p>
</div>
<![endif]>
</div>

它在页眉和文档主体中显示“页眉”文本。我发现资源(http://techsynapse.blogspot.com/2007/03/generating-word-document-dynamically.html 和 http://www.pbdr.com/ostips/wordfoot.htm)说如果不使用额外的头文件就无法避免这种影响这对我来说不是一个选择。

我的问题是:您知道解决该问题的方法吗?如何在主文档中隐藏标题的出现,但将其留在页面顶部的位置?提前感谢您的任何建议。

最佳答案

这对我有用:

<html
xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:w='urn:schemas-microsoft-com:office:word'
xmlns='http://www.w3.org/TR/REC-html40'>
<head><title></title>

<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:Zoom>90</w:Zoom>
</w:WordDocument>
</xml><![endif]-->


<style>
p.MsoFooter, li.MsoFooter, div.MsoFooter
{
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
font-size:12.0pt;
}
<style>

<!-- /* Style Definitions */

@page Section1
{
size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-title-page:yes;
mso-header: h1;
mso-footer: f1;
mso-first-header: fh1;
mso-first-footer: ff1;
mso-paper-source:0;
}


div.Section1
{
page:Section1;
}

table#hrdftrtbl
{
margin:0in 0in 0in 900in;
width:1px;
height:1px;
overflow:hidden;
}
-->
</style></head>

<body lang=EN-US style='tab-interval:.5in'>
<div class=Section1>

<p> CONTENT </p>

<br/>
<table id='hrdftrtbl' border='0' cellspacing='0' cellpadding='0'>
<tr><td>

<div style='mso-element:header' id=h1 >
<p class=MsoHeader ><p>&nbsp;HEADER-TITLE</p></p>
</div>

</td>
<td>
<div style='mso-element:footer' id=f1>

<p>&nbsp;FOOTER-TITLE</p>
<p class=MsoFooter>
<span style=mso-tab-count:2'></span>
Page <span style='mso-field-code: PAGE '><span style='mso-no-proof:yes'></span></span> of <span style='mso-field-code: NUMPAGES '></span>
</p>

</div>



<div style='mso-element:header' id=fh1>

<p class=MsoHeader><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;FIRST-HEADER-TITLE<o:p></o:p></span></p>

</div>

<div style='mso-element:footer' id=ff1>

<p class=MsoFooter><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;FIRST-FOOTER-TITLE<o:p></o:p></span></p>

</div>

</td></tr>
</table>


</body></html>

关于html - Office HTML Word header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9340527/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com