Free Support Forum - aspose.com

Filename in Header

How can add the filename in the header of a word document with aspose, with page and pagenumber i've no problems.

Thanks.

Hi

Thanks for your inquiry. You can try using the following code.

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);

builder.InsertField(@"FILENAME \* MERGEFORMAT", "");

But you should update FILENAME field manually, because Aspose.Words doesn’t evaluate this field. See FAQ for more information.

Best regards.