Free Support Forum - aspose.com

SAVEDATE field not updating in Word

When creating a Word document via Aspose, I use the following code to create a SAVEDATE field:

fieldCode = @"SAVEDATE \@ ""MMMM d, yyyy"" \* MERGEFORMAT";
fieldValue = DateTime.UtcNow.ToString("MMMM d, yyyy");

builder.InsertField(fieldCode, fieldValue);

However the fieldValue does not end up displaying immediately in the doc created in Word until the doc is saved and re-loaded (the first load is via download from the web). Instead it just shows

XXX 0, 0000

Is there anything we can do?

Thanks,

Steve

Hi

Thanks for your interest in Aspose products. I think that you should set LastSavedTime. See the following code.

doc.BuiltInDocumentProperties.LastSavedTime = DateTime.UtcNow;

string fieldCode = @"SAVEDATE \@ ""MMMM d, yyyy"" \* MERGEFORMAT";

string fieldValue = DateTime.UtcNow.ToString("MMMM d, yyyy");

builder.InsertField(fieldCode, fieldValue);

I hope that this will help you.

Best regards.