We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need to read "header and footer" and replace key values of a document

image.png (9.5 KB)
here i need to change value of metadata on footer and on header
which have already replaced in body part as “03/012019” and “AUTO13626” respectively

Thanks for your inquiry. Please ZIP and attach your input document here for testing. We will test the scenario on our end and provide you information accordingly.
Thanks for your cooperation.

Thank you for quick responce
i have attached file as pdf
i am using aspose.words for java here values are key value pair in map
Renewal Date:03/01/2019
Effective Date:03/01/2020
Contract ID:AUTO1150
Contract Title:Title
Contract Period:2
Company Name:Name
these values are replaced in body part but i couldnt replace in header footer part
77777 (1).zip (15.9 KB)
77777 (1).pdf (96.8 KB)


Thanks for sharing documents. Please use the following workaround to replace text in Header and Footer. Hope, this helps.

HeaderFooterCollection headersFooters = doc.getFirstSection().getHeadersFooters();
HeaderFooter header = headersFooters.getByHeaderFooterType(HeaderFooterType.HEADER_PRIMARY);
HeaderFooter footer = headersFooters.getByHeaderFooterType(HeaderFooterType.FOOTER_PRIMARY);

FindReplaceOptions options = new FindReplaceOptions();

header.getRange().replace("Contract ID", "AUTO1150", options);
footer.getRange().replace("Effective Date", "03/01/2020", options);