Header Layout Margins

Hello,

I'm trying to modify my page setup so that the Header starts 0.25" from the top of the page. I've tried setting my page margins but they don't affect where the header starts. In word, I can go to Print>Custom Margins>Layout>Headers and footers to change my Header margin "From edge" to 0.25" to the desired effect.

I'm wondering if theres asection.PageSetup.Margins.Header = 18f; or similar that I can use to modify this value. I've attached a screenshot of the value I'm trying to set in my code.


Attachment: Header_Margin_4777c932.zip

2 Replies

MR Manikandan Ravichandran Syncfusion Team March 16, 2020 12:49 PM UTC

Hi Jordan,

Thank you for your update.

Currently we are checking the reported issue. We will update the details within today EOD.

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



MR Manikandan Ravichandran Syncfusion Team March 16, 2020 04:12 PM UTC

Hi Jordan,

Thank you for your patience.

From the given details, we suspect that your requirement is to change the Header and footer distance of the input word document. To change the header and footer distance in the word document, we suggest you to use the following code example.

 
WordDocument document = new WordDocument(@"Sample.docx");
foreach (WSection section in document.Sections)
{
     section.PageSetup.HeaderDistance = 20f;
     section.PageSetup.FooterDistance = 20f;
}          
document.Save(
"Output.docx", FormatType.Docx);
document.Close();
 

If you think, we misunderstood any of your requirement, then kindly provide us modified sample of the above along with input template Word document, screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran


Loader.
Up arrow icon