SaveOptionsUpdateLastSavedTimeProperty Property

Gets or sets a value determining whether the LastSavedTime property is updated before saving.

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.2.0


public bool UpdateLastSavedTimeProperty { get; set; }

Property Value

Type: Boolean


Shows how to determine whether to preserve the document's "Last saved time" property when saving.
Document doc = new Document(MyDir + "Document.docx");

Assert.AreEqual(new DateTime(2020, 7, 30, 5, 27, 0), 

// When we save the document to an OOXML format, we can create an OoxmlSaveOptions object
// and then pass it to the document's saving method to modify how we save the document.
// Set the "UpdateLastSavedTimeProperty" property to "true" to
// set the output document's "Last saved time" built-in property to the current date/time.
// Set the "UpdateLastSavedTimeProperty" property to "false" to
// preserve the original value of the input document's "Last saved time" built-in property.
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.UpdateLastSavedTimeProperty = updateLastSavedTimeProperty;

doc.Save(ArtifactsDir + "OoxmlSaveOptions.LastSavedTime.docx", saveOptions);

doc = new Document(ArtifactsDir + "OoxmlSaveOptions.LastSavedTime.docx");
DateTime lastSavedTimeNew = doc.BuiltInDocumentProperties.LastSavedTime;

if (updateLastSavedTimeProperty)
    Assert.That(DateTime.Now, Is.EqualTo(lastSavedTimeNew).Within(1).Days);
    Assert.AreEqual(new DateTime(2020, 7, 30, 5, 27, 0), 

ExpandedSee Also