Date field not updating when printing

I’m currently evaluating Aspose.Words (v15.12.0.0) and I have a question about date fields in documents.

My process can be reduced to:

  1. Open document template (.dot).
  2. Manipulate document (editing merge fields and tables).
  3. Print document.
  4. Save document as PDF.

My document template has a date field { DATE @ “dd/MM/yyyy” } which
when printed from Microsoft Word (Automation) is updated with the current date. I have noticed when migrated to Aspose.Words, that when the document is printed at stage 3, the date field is not updated. However when the document is converted to a PDF at stage 4, the date field is updated. Is this the expected behaviour?

Hi Chris,

Thanks for your inquiry. You can simply call Document.UpdateFields method before Document.Print method to match dates on printed and PDF files i.e. dates will be updated in both cases.

Conversely, if you don’t want updated dates in PDF as well, please use the following code:

PdfSaveOptions opts = new PdfSaveOptions();
opts.UpdateFields = false;
doc.Save(MyDir + @"16.1.0.pdf", opts);

Hope, this helps.

Best regards,