如何使用html将页眉页脚添加到世界文档 [英] how to add header an footer to world document using html
本文介绍了如何使用html将页眉页脚添加到世界文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请任何人告诉我如何使用html为MS单词添加页眉和页脚
在此先感谢
Please any one tell me how to add the header and footer for the MS word using html
Thanks in advance
推荐答案
使用Office Open XML SDK向Word文档添加页眉和页脚.据我了解,您有一个html文件,其中有页眉和页脚.因此,使用Office Open XML SDK很容易.
您需要这样使用
Use Office Open XML SDK to add headers and footers to the word document. As I understand you have an html file where you have header and a footer. So, its easy to do with Office Open XML SDK.
You need to use like this
namespace OOXML
{
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
public class WordProcess
{
/// read header and footer strings from html and then call AddHeader
/// by passing the existing word file
public void AddHeader(string wordFile, string header, string footer)
{
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(wordFile, true))
{
foreach (HeaderPart hp in wordDoc.MainDocumentPart.HeaderParts)
{
// add/modify header values
Header h = hp.Header;
}
foreach (FooterPart fp in wordDoc.MainDocumentPart.FooterParts)
{
// add/modify footer values
Footer f = fp.Footer;
}
}
}
}
}
如需更多帮助,请访问此链接
http://openxmldeveloper.org/ [ ^ ]
For more help visit this link
http://openxmldeveloper.org/[^]
这篇关于如何使用html将页眉页脚添加到世界文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文