使用asp c#编辑Word文件,我想动态地向MS-Word文件添加页眉页脚...并将其应用于所有页面..页脚包含图片 [英] edit word file using asp c#,i want to add header footer to a ms-word file dynamcally...and apply it to all pages..footer contain pictures
本文介绍了使用asp c#编辑Word文件,我想动态地向MS-Word文件添加页眉页脚...并将其应用于所有页面..页脚包含图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
请帮我解决这个问题...
使用asp c#编辑ms-word文件,我想动态地将标题页脚添加到ms-word文件中...并将其应用于所有页面..footer包含图片...并保存.
在此先感谢.
解决方案
希望 ^ ]可能会为您提供帮助.
使用 MSDN [ ^ ]
您可以使用C#/VB.NET Word 组件.
这是一个示例 C#DOCX 代码:
// 在自由模式下使用组件. ComponentInfo.SetLicense(" ); // 从文件中加载文档. var document = DocumentModel.Load(" ,LoadOptions.DocxDefault); // 从文档中获取单个部分. var section = document.Sections.单个(); // 将标题添加到该部分. section.HeadersFooters.Add(新 HeaderFooter(文档,HeaderFooterType.HeaderDefault,新段落(文档," ))))); // 将带有图像的页脚添加到该部分. section.HeadersFooters.Add(新 HeaderFooter(document,HeaderFooterType.FooterDefault, new Paragraph(document,新建图片(文档," )))); // 将文档保存到文件中. document.Save(" ,SaveOptions.DocxDefault);
Hi All,
Please help me to solve this problem...
Edit ms-word file using asp c#,i want to add header footer to a ms-word file dynamcally...and apply it to all pages..footer contain pictures...and save it.
Thanks in Advance.
解决方案
Hope this[^] might help you.
Go with MSDN[^]
Hi,
you can easily C# edit Word with this C# / VB.NET Word component.
Here is a sample C# DOCX code:
// Use the component in free mode. ComponentInfo.SetLicense("FREE-LIMITED-KEY"); // Load a document from the file. var document = DocumentModel.Load("Document.docx", LoadOptions.DocxDefault); // Get a single section from the document. var section = document.Sections.Single(); // Add a header to the section. section.HeadersFooters.Add(new HeaderFooter(document, HeaderFooterType.HeaderDefault, new Paragraph(document, "This is header content"))); // Add a footer with an image to the section. section.HeadersFooters.Add(new HeaderFooter(document, HeaderFooterType.FooterDefault, new Paragraph(document, new Picture(document, "MyImage.png")))); // Save the document to a file. document.Save("Document.docx", SaveOptions.DocxDefault);
这篇关于使用asp c#编辑Word文件,我想动态地向MS-Word文件添加页眉页脚...并将其应用于所有页面..页脚包含图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文