See attached sample: when creating a field of type “FieldType.FieldSaveDate” and the document is saved by Aspose.Words, the value is initially “0”. It starts working if the document is edited by word, saved and reopened.
I would expect that is shows the time when “Document.Save” was called.
A call to “Field.Update” or “Document.UpdateFields” does not help.
It gets even worse if you load a template: now the date is the last save time of the template file. Click button “create from template” to reproduce this.
Is this a misunderstanding of mine or a bug?
When creating a blank doc, the user might understand that the “0” values will be filled when first saved. But at least the second problem (create from template) causes real trouble for me, because the customers will see a date in the result file that they don’t understand and that makes no sense to them.
We tested the above scenarios and have managed to reproduce the same problems on our end. For the sake of corrections, we have logged the following issues in our issue tracking system.
WORDSNET-19842: Field “SaveDate” is initially not set WORDSNET-19843: Field “SaveDate” is not correctly set for Aspose.Words generated Documents
We will further look into the details of these issues and will keep you updated on the status of corrections. We apologize for your inconvenience.
Please keep in mind the locale specific date format - in my sample I set “Document.Styles.DefaultFont.LocaleId” to “German”. I don’t whether this is something that you must handle or whether Word will take care of it.
Thanks for the additional information. We have logged these details in our issue tracking system and will inform you when the linked issue will be resolved in future. We apologize for any inconvenience.
During further investigation, we have found that the problem you reported here is actually an expected behavior. In the past, we had implemented this behavior as per another issue WORDSNET-7912. Please see Aspose.Words for .NET 17.9 Release Notes for more details. You should explicitly set SaveOptions.UpdateLastSavedTimeProperty to get desired results.
So, there are two ways to update that field on save:
But there is one problem: the date in the document is one hour in the future. I don’t know whether this is caused by our timezone (germany has GMT+1) or by daylight saving time. Current GMT when writing this post is 12:30, local time is 13:30, and the word document has 14:30.