Ultimate Word - Different Margins for header, main body, and footer


Hey ComponentPro,

I am currently generating a document that uses an image as a header and footer. The problem I am trying to solve is that I need a larger margin size for the text in the document, but changing the margin size affects the entire document, preventing me from correctly displaying the header/footer images. I would add tabs to all the text, but that doesn't change where the other end gets word wrapped. I could attempt to estimate the cut off locations and hardcode newlines, but the text in the documents is dynamic and the solution wouldn't produce adequate results without a disproportionate amount of work.

The margins are set and the header is added in the following manner:

[code lang='c#']

Section section = document.AddSection();
section.PageSetup.PageSize = new SizeF(8.5f * 72, 11 * 72);
section.PageSetup.Margins = new MarginsF(20f);
section.PageSetup.HeaderDistance = 0;
Paragraph par = section.HeadersFooters.Header.AddParagraph();
par.AppendPicture(<header image>);


If there were a way to set margins per paragraph or potentially a better way to add a header image to a WordDocument that isn't directly affected by section margins, I would be able to sufficiently manipulate margins.

Do you have a solution to this problem?




edited 12/3/2017 12:36:22 AM
asked 1/29/2015 2:58:59 PM
add a comment

1 Answers


Do you have any solutions, are you working on anything, or is it just not possible?


Please give me an acknowledging response in any case. I need to know the status of this issue.



answered 11/16/2017 12:41:37 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged word or ask your own question.