Free Support Forum -

Setting a left/right margins for the Header/Footer


We have a requirement to have the right margin for our documents set at 2 cm, but the image logo in the header must be 1 cm from the right. I would like to know how I can set the left and right margin specifically for the Header, as I don’t see anything like that in the PageSetup documentation.


Hi Hanno,

Thanks for your inquiry.

The left/right margins you specify via PageSetup.LeftMargin/PageSetup.RightMargin properties are applicable to the main body and to the headers/footers content present in the containing Section. I think, in your case you can insert a floating logo image in header at a specified x-y position. Please see the following code:

DocumentBuilder builder = new DocumentBuilder();


Shape shape = builder.InsertImage(@"C:\Temp\Aspose.Words.png");

shape.WrapType = WrapType.None;

shape.Left = 72 * 5;

builder.Document.Save(@"C:\Temp\Image.CreateFloatingPageCenter Out.doc");

I hope, this helps.

Best regards,

Thanks. :slight_smile:

I’ll try it out and let you know if I have any further queries.