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:
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();
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?