This project has moved. For the latest updates, please go here.

Edit docx header

Aug 8, 2012 at 10:31 PM

So, I looked around and did not find anything that would help me.

Is there a way I can edit the docx header? I need to add a tag at the beginning of all pages. A header or a way to place a string at a certain position in everypage will do :)

 

Thanks,

Lucas

Coordinator
Aug 9, 2012 at 10:56 AM

Sorry nothing automatic in Html2OpenXml.

You could still design your header with a simple html (not too complex), then convert it using this library and capture the paragraphs generated (the returned value of HtmlConverter.Parse()
Then insert the paragraphs inside a HeaderPart

Aug 14, 2012 at 12:20 AM

Sy it took me so long to reply back. I had other priorities to do first.

 

I'm a little bit lost here. In the samples, you get or create the document body using:

MainDocumentPart mainPart = package.MainDocumentPart;

right?

 

But I did not find anything similar to the Header. I could create a new HeaderPart object, but I don't know how to append that to my Document.

Are there any exemples I can see?

Thanks

Coordinator
Sep 6, 2012 at 5:59 PM

Sorry for delay, same as me.
maybe you can take some inspiration from this link.