How to insert a line under the header content and over the footer content

Hi, support,
I have a question that is the header/footer content can be added/cleared/modified by using aspose.words.dll, however, if the header/footer will be added, the line under the header content or above the footer content disappear. My question is that how to insert the separate line?

Thanks for your help!

Ducaisoft

@ducaisoft

Thanks for your inquiry. Yes, you can add, remove and modify the content of header/footer of Word document using Aspose.Words. Please read the following articles.
How to Create Headers Footers using DocumentBuilder
How to Remove Footers but Leave Headers Intact
Using DocumentBuilder to Modify a Document Easily

Please ZIP and attach your input and expected output Word documents here for our reference. We will then provide you more information about your query along with code. You can create your expected output document using MS Word.

Thanks for your reply.
Please refer to the attachment for testing.
Test.zip (27.1 KB)

@ducaisoft

Thanks for sharing the detail. In your desired output document, you have set the bottom border of paragraph. Please use the following code example get the desired output.

We suggest you please read the following article.
Borders and Shading

Document doc = new Document(MyDir + @"input.docx");
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
documentBuilder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
documentBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
documentBuilder.ParagraphFormat.Borders.Bottom.LineStyle = LineStyle.Single;
documentBuilder.Write("This is Header");

doc.Save(MyDir + "19.2.docx");