使用 openxml 将标头添加到 docx
我正在尝试向已包含标头 (header1.xml) 的 docx (office 2010) 文档添加一个新标头(通过使用 openxml 代码手动)。 我尝试通过添加一个名为 myheader.xml 且只有一个段落的文件来使用 openxml 来完成此操作。 当在word中打开文档时,header1的内容显示在与以前不同的位置(低2行)。
当我删除该段落时,(只有
这个问题有解决方案吗?
I'm trying to add a new header (manually by using openxml code) to docx (office 2010) document which already contains a header (header1.xml).
I tried to do it with openxml by adding a file named myheader.xml with only one paragraph.
When opening the document at word, the content of header1 is presented in different position (2 lines lower) than it was before.
When I deleted the paragraph, (only <w:hdr> </w:hdr>
with the relevant name spaces) the content of header1 was still presented in a different potion ( only 1 line lower)
Is there a solution for this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您在这里查看此线程: 使用 OpenXML SDK 2.0 将页眉和页脚添加到现有的空 Word 文档
我认为会这样解决这个问题,因为它比只添加一个段落更复杂一些,但不多。
I suggest you check out this thread here: Add Header and Footer to an existing empty word document with OpenXML SDK 2.0
I think it will this solve this problem as, its a little more involed that just adding a paragraph, but not much.