Range.UpdateFields() does not work in HeaderFooter class?

Hi,
I’m executing some automation using Aspose.Words by changing document properties using the BuiltInDocumentProperties. A number of these properties live within the document themselves, others are located in the footers.
When I change a document property and execute a Document.Range.UpdateFields() call, the properties within the document change, but not the footers.
I tried explicitly executing UpdateFields on the footers as follows: (iSection is a loop counter of all document sections)

myWordDocument.Sections[iSection].HeadersFooters[Aspose.Words.HeaderFooterType.FooterPrimary].Range.UpdateFields();

However, this still does not update the footers.
The property I am updating is the Author property, and it works if located in the document.
Any thoughts on how to achieve this?
Regards,
Rowan.

Hi
Thanks for your request. I tied to update fields and it seems that all works fine on my side. I used the following code for testing.

Document doc = new Document(@"296_100022_rowanmiller\in.doc");
doc.BuiltInDocumentProperties.Author = "test";
doc.Range.UpdateFields();
doc.Save(@"296_100022_rowanmiller\out.doc");

Please attach your document and some code that will allow me to reproduce this problem.
Best regards.

Hi Alexey,
Thanks for the response. Attached is a sample document to reproduce the error.
The following code (C#) is what we use to update our document. Just call this function with appropriate parameters. It saves the file out to the same filename.

private void UpdateBriefTemplateFileWithPropertyValues(string sFileName, string sTitle, string sAuthor, string sCategory, string sSubmissionNumber, string sPortfolio, string sCabinetMeetingDate, string sPhoneNumber)
{
    Aspose.Words.Document myWordDocument = new Aspose.Words.Document(sFileName);
    myWordDocument.BuiltInDocumentProperties.Title = sTitle;
    myWordDocument.BuiltInDocumentProperties.Author = sAuthor;
    myWordDocument.BuiltInDocumentProperties.Category = sCategory;
    // Submission Number
    if (myWordDocument.CustomDocumentProperties.Contains("SubmissionNum"))
        myWordDocument.CustomDocumentProperties["SubmissionNum"].Value = sSubmissionNumber;
    else
        myWordDocument.CustomDocumentProperties.Add("SubmissionNum", sSubmissionNumber);
    // Portfolio
    if (myWordDocument.CustomDocumentProperties.Contains("Portfolio"))
        myWordDocument.CustomDocumentProperties["Portfolio"].Value = sPortfolio;
    else
        myWordDocument.CustomDocumentProperties.Add("Portfolio", sPortfolio);
    // Cabinet Meeting Date/Time
    if (myWordDocument.CustomDocumentProperties.Contains("CabinetMeetingDate"))
        myWordDocument.CustomDocumentProperties["CabinetMeetingDate"].Value = sCabinetMeetingDate;
    else
        myWordDocument.CustomDocumentProperties.Add("CabinetMeetingDate", sCabinetMeetingDate);
    // Phone Number
    if (myWordDocument.CustomDocumentProperties.Contains("PhoneNumber"))
        myWordDocument.CustomDocumentProperties["PhoneNumber"].Value = sPhoneNumber;
    else
        myWordDocument.CustomDocumentProperties.Add("PhoneNumber", sPhoneNumber);
    myWordDocument.Document.Range.UpdateFields();
    for (int iSection = 0; iSection < myWordDocument.Sections.Count; iSection++)
    {
        myWordDocument.Sections[iSection].HeadersFooters[Aspose.Words.HeaderFooterType.FooterEven].Range.UpdateFields();
        myWordDocument.Sections[iSection].HeadersFooters[Aspose.Words.HeaderFooterType.FooterFirst].Range.UpdateFields();
        myWordDocument.Sections[iSection].HeadersFooters[Aspose.Words.HeaderFooterType.FooterPrimary].Range.UpdateFields();
    }
    myWordDocument.Save(sFileName);
}

Hi
I looked through the document and it seems that you use the AUTOR field but not the DOCPROPERTY field. That’s why this field is not updated.
Here is your field code { AUTHOR \* MERGEFORMAT }
But you should use this { DOCPROPERTY Author \* MERGEFORMAT }
Press Alt+F9 to show the field codes in your document.
Best regards.

Hi Alexey,
That did the trick - thanks.
Regards,
Rowan.