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

@karthik.m
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.

@mannanfazil
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
ex:
Renewal Date:03/01/2019
Effective Date:03/01/2020
Contract ID:AUTO1150
Contract Title:Title
Contract Period:2
Region:Asia
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)

@karthik.m

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();
options.setMatchCase(true);
options.setFindWholeWordsOnly(true);

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