Thetype exposes the following members.
Gets or sets the author of this revision. Can not be empty string or null.
Gets or sets the date/time of this revision.
Gets the revision group. Returns null if the revision does not belong to any group.
Gets the immediate parent node (owner) of this revision. This property will work for any revision type other than StyleDefinitionChange.
Gets the immediate parent style (owner) of this revision. This property will work for only for the StyleDefinitionChange revision type.
Gets the type of this revision.
Accepts this revision.
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Serves as a hash function for a particular type.(Inherited from Object.)
Gets the type of the current instance.(Inherited from Object.)
Creates a shallow copy of the current Object.(Inherited from Object.)
Reject this revision.
Returns a string that represents the current object.(Inherited from Object.)
[C#] Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Normal editing of the document does not count as a revision builder.Write("This does not count as a revision. "); Assert.IsFalse(doc.HasRevisions); // In order for our edits to count as revisions, we need to declare an author and start tracking them doc.StartTrackRevisions("John Doe", DateTime.Now); builder.Write("This is revision #1. "); // This flag corresponds to the "Track Changes" option being turned on in Microsoft Word, to track the editing manually // done there and not the programmatic changes we are about to do here Assert.IsFalse(doc.TrackRevisions); // As well as nodes in the document, revisions get referenced in this collection Assert.IsTrue(doc.HasRevisions); Assert.AreEqual(1, doc.Revisions.Count); Revision revision = doc.Revisions; Assert.AreEqual("John Doe", revision.Author); Assert.AreEqual("This is revision #1. ", revision.ParentNode.GetText()); Assert.AreEqual(RevisionType.Insertion, revision.RevisionType); Assert.AreEqual(revision.DateTime.Date, DateTime.Now.Date); Assert.AreEqual(doc.Revisions.Groups, revision.Group); // Deleting content also counts as a revision // The most recent revisions are put at the start of the collection doc.FirstSection.Body.FirstParagraph.Runs.Remove(); Assert.AreEqual(RevisionType.Deletion, doc.Revisions.RevisionType); Assert.AreEqual(2, doc.Revisions.Count); // Insert revisions are treated as document text by the GetText() method before they are accepted, // since they are still nodes with text and are in the body Assert.AreEqual("This does not count as a revision. This is revision #1.", doc.GetText().Trim()); // Accepting the deletion revision will assimilate it into the paragraph text and remove it from the collection doc.Revisions.Accept(); Assert.AreEqual(1, doc.Revisions.Count); // Once the delete revision is accepted, the nodes that it concerns are removed and their text will not show up here Assert.AreEqual("This is revision #1.", doc.GetText().Trim()); // The second insertion revision is now at index 0, which we can reject to ignore and discard it doc.Revisions.Reject(); Assert.AreEqual(0, doc.Revisions.Count); Assert.AreEqual("", doc.GetText().Trim()); // This takes us back to not counting changes as revisions doc.StopTrackRevisions(); builder.Writeln("This also does not count as a revision."); Assert.AreEqual(0, doc.Revisions.Count); doc.Save(ArtifactsDir + "Document.Revisions.docx");