Free Support Forum - aspose.com

Empty line after table in document header

Hello,
I have a document header made of one table. The table is followed by an empty line (see image).
How to remove this empty line ? Or if not possible, how to access this line to set font size to 1 ?

thanks
Stephane




Hi Stephane,


Thanks for your inquiry. You can simply remove that last Paragraph by using the following code snippet:

Document
doc = new Document(@“C:\Temp\in.docx”);

HeaderFooter hf = doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderPrimary];

hf.LastParagraph.Remove();

doc.Save(@"C:\Temp\out.docx");


I hope, this helps.

Best regards,

Perfect! It works as expected.
Thanks for precise answer.
Regards

Stephane