Subject: Ultimate Word - Different Margins for header, main body, and footer
Date: 2015-01-29 14:58:59
From: Eddie Olson
Source: ultimate-word-different-margins-header-main-body-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>);

[/code]

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?

 

Eddie

WorldStrides

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index