Hi
Thanks for your request. You can try to use ParagraphFormat.LeftIdent property. See the following example.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Section currentSection = builder.CurrentSection;
PageSetup pageSetup = currentSection.PageSetup;
pageSetup.DifferentFirstPageHeaderFooter = true;
// --- Create header for the first page. ---
pageSetup.HeaderDistance = 20;
// set leftmargin
pageSetup.LeftMargin = 30;
builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
// set leftident for header.
builder.ParagraphFormat.LeftIndent = -30;
builder.Write("Aspose.Words Header/Footer Creation Primer - Title Page.");
builder.MoveToDocumentStart();
builder.Write("Text in body");
// Save the resulting document.
doc.Save(@"134_91963_Pizzi\out.doc");
Hi,
Thank you for your fast answer.
Indeed we figured out that the only possibility we have is to work with the “LeftIndent” in order to obtain the requested result.
It would be very nice anyway, to have the direct formatting of the footer/header in the way that all the nested object would inherit those settings.
Something Like
header.LeftMargin
header.TopMargin
header.RightMargin
and for the footer
footer.LeftMargin
footer.RightMargin
footer.BottomMargin
Hi
I think that you can’t set different margins for header/footer and for body in MSWord. That’s why you can’t do this using Aspose.Words.
Best regards.
Hi @SV-555 ,
is this any solution available for that above one?!..
I need to give the Margin(left,right,top,bottom) for Header and Footer if any other solution you have?
Thanks for your inquiry. Please use the properties LeftMargin, TopMargin, RightMargin, BottomMargin of PageSetup class as shown below to achieve your requirement. Hope this helps you.
Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. MS Word sets the page margins for page’s body and page header and footer.
In your case, we suggest you please insert the table with one cell, without border and have width 80% of page into header and footer. Insert the content into table.
If you still face problem, please ZIP and attach your input and expected output documents. We will then provide you more information about your query.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.