Update fields not work properly

Hi,

I have a simple code below to update document fields and header/footer fields. In the test document, I include Title and Author fields. However, the code doesn’t work for me. Title and Author properties are change, but the fields in output document aren’t changed anymore though. I attach input/output document. Could you help to review if I miss something?

Aspose.Words.Document doc = new Aspose.Words.Document("Test.docx");

doc.UpdateFields();
doc.FirstSection.HeadersFooters[Aspose.Words.HeaderFooterType.HeaderPrimary].Range.UpdateFields();
doc.FirstSection.HeadersFooters[Aspose.Words.HeaderFooterType.FooterPrimary].Range.UpdateFields();

doc.Save("Test1.docx");

Thanks in advance.

Vu

Hello
Thanks for your request. Currently Aspose.Words cannot update TITLE/AUTHOR field in the document. However, Aspose.Words can update DOCPROPERTY fields. So you can use it instead TITLE/AUTHOR field. Here is field code:
{ DOCPROPERTY Title \* MERGEFORMAT }

You will be notified as soon as it is supported.
Also please see the following simple code:

// Open a sample document in Aspose.Words.
Document doc = new Document("C:\\Temp\\in3.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
doc.BuiltInDocumentProperties.Title = "MyTitle";
builder.InsertField("DOCPROPERTY Title \\* MERGEFORMAT");
doc.UpdateFields();
doc.Save("C:\\Temp\\out.docx");

The same for AUTHOR field.

Best regards,

Hi Andrey,

Thanks for quick reply.

Actually, I can’t do as your code because the document is made from customer’s template.

Regards,

Vu

Hello
Thanks for your request. Unfortunately, currently Aspose.Words cannot update TITLE/AUTHOR field in the document. You will be notified as soon as this feature is supported.
Best regards,

The issues you have found earlier (filed as WORDSNET-4680) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)