ParagraphIsInsertRevision Property

Returns true if this object was inserted in Microsoft Word while change tracking was enabled.

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


public bool IsInsertRevision { get; }

Property Value

Type: Boolean


Shows how to work with revision paragraphs.
Document doc = new Document();
Body body = doc.FirstSection.Body;
Paragraph para = body.FirstParagraph;

// Add text to the first paragraph, then add two more paragraphs
para.AppendChild(new Run(doc, "Paragraph 1. "));
body.AppendParagraph("Paragraph 2. ");
body.AppendParagraph("Paragraph 3. ");

// We have three paragraphs, none of which registered as any type of revision
// If we add/remove any content in the document while tracking revisions,
// they will be displayed as such in the document and can be accepted/rejected
doc.StartTrackRevisions("John Doe", DateTime.Now);

// This paragraph is a revision and will have the according "IsInsertRevision" flag set
para = body.AppendParagraph("Paragraph 4. ");

// Get the document's paragraph collection and remove a paragraph
ParagraphCollection paragraphs = body.Paragraphs;
Assert.AreEqual(4, paragraphs.Count);
para = paragraphs[2];

// Since we are tracking revisions, the paragraph still exists in the document, will have the "IsDeleteRevision" set
// and will be displayed as a revision in Microsoft Word, until we accept or reject all revisions
Assert.AreEqual(4, paragraphs.Count);

// The delete revision paragraph is removed once we accept changes
Assert.AreEqual(3, paragraphs.Count);
Assert.That(para, Is.Empty);

ExpandedSee Also