First Page Header Field not updating

I have a template file that has first page header and the header for other pages. Both the headers contains filed for current page and the total page count.

I am copying the headers from this template to a document. After setting fields in the template I call

doc.Range.UpdateFields();

and save it. The resulting file updates all the properties, except the page count in the first page header. ll reflects the value copied from the template. Since the template had 2 pages, it shows as Page 1 of 2. The headers in the other pages are updated fine.

Is there any other call to update first page header field?

Hi
Thanks for your inquiry. UpdateFields method does not update page numbers and page count fields. This method updates DOCPROPERTY and DOCVARIABLE fields only.
If you need to update all fields inside your document you should do this manually (ctrl+A and F9). Also you can use macro to update fields. See the following link to learn more.
https://support.microsoft.com/en-us/topic/the-filename-field-does-not-automatically-update-when-you-open-a-document-in-word-de2bfb95-d990-1ced-a618-5ac0a2ec1be4
Best regards.