Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 21-Jun-11 1:42am
v2
Comments
R. Giskard Reventlov 21-Jun-11 7:28am    
What have you tried so far?

Hope this[^] might help you.
 
Share this answer
 
Go with MSDN[^]
 
Share this answer
 
Comments
anoop88 21-Jun-11 12:22pm    
really thankful to u to give solution to the problem.
anoop88 21-Jun-11 12:24pm    
how to add Microsoft.Office.Interop.Word to my project.. i got error while adding it...please give me a solution...
koolprasad2003 21-Jun-11 23:53pm    
Go through my article, which will give you a way to add assembly reference to your project.
http://www.codeproject.com/KB/vb/WordAutomationPart1.aspx

Queries welcome.

- If you have solved your problem then mark the Question as SOLVED and accept answer.
Hi,

you can easily C# edit Word with this C# / VB.NET Word component.

Here is a sample C# DOCX code:
C#
// 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);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900