DocumentVersionsCount Property

Gets the number of document versions that was stored in the DOC document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.9.0


public int VersionsCount { get; }

Property Value

Type: Int32


Versions in Microsoft Word are accessed via the File/Versions menu. Microsoft Word supports versions only for DOC files.

This property allows to detect if there were document versions stored in this document before it was opened in Aspose.Words. Aspose.Words provides no other support for document versions. If you save this document using Aspose.Words, the document will be saved without versions.


Shows how to work with the versions count feature of older Microsoft Word documents.
Document doc = new Document(MyDir + "Versions.doc");

// We can read this property of a document, but we cannot preserve it while saving.
Assert.AreEqual(4, doc.VersionsCount);

doc.Save(ArtifactsDir + "Document.VersionsCount.doc");      
doc = new Document(ArtifactsDir + "Document.VersionsCount.doc");

Assert.AreEqual(0, doc.VersionsCount);

See Also