Hi.
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.
Thanks
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();
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
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.
I’ll try it out and let you know if I have any further queries.