Class Revision
Represents a revision (tracked change) in a Word document.
Inheritance
System.Object
Revision
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class Revision : Object
Properties
Author
Gets the name of the user who made the specified tracked change.
Declaration
public string Author { get; }
Property Value
Type |
---|
System.String |
Examples
//Loads an existing Word document
WordDocument document = new WordDocument(@"Template.docx");
//If the author of current revision is same as expected author name, then accept it
if (document.Revisions[0].Author == "Syncfusion")
document.Revisions[0].Accept();
//Saves and closes the Word document
document.Save("Sample.docx", FormatType.Docx);
document.Close();
'Loads an existing Word document
Dim document As WordDocument = New WordDocument("Template.docx")
'If the author of current revision is same as expected author name, then accept it
If document.Revisions(0).Author Is "Syncfusion" Then worddocument.Revisions(0).Accept()
'Saves and closes the Word document
document.Save("Sample.docx", FormatType.Docx)
document.Close()
Date
Gets the date and time that the tracked change was made.
Declaration
public DateTime Date { get; }
Property Value
Type |
---|
System.DateTime |
Examples
//Loads an existing Word document
WordDocument document = new WordDocument(@"Template.docx");
DateTime dateTime = DateTime.Parse("2020 - 05 - 28T20: 26:00");
//If the date of current revision same as expected date, then accepts it
if (document.Revisions[0].Date == dateTime)
document.Revisions[0].Accept();
//Saves and closes the Word document
document.Save("Sample.docx", FormatType.Docx);
document.Close();
'Loads an existing Word document
Dim document As WordDocument = New WordDocument("Template.docx")
Dim dateTime As Date = Date.Parse("2020 - 05 - 28T20: 26:00")
'If the date of current revision same as expected date, then accepts it
If document.Revisions(0).[Date] Is dateTime Then wordDocument.Revisions(0).Accept()
'Saves and closes the Word document
document.Save("Sample.docx", FormatType.Docx)
document.Close()
RevisionType
Gets the type of the track change revision.
Declaration
public RevisionType RevisionType { get; }
Property Value
Type |
---|
RevisionType |
Examples
//Loads an existing Word document
WordDocument document = new WordDocument("Template.docx");
//If the revision is insertion type of revision, then accept it
if (document.Revisions[0].RevisionType == RevisionType.Insertions)
document.Revisions[0].Accept();
//Saves and closes the Word document
document.Save("Sample.docx", FormatType.Docx);
document.Close();
'Loads an existing Word document
Dim document As WordDocument = New WordDocument("C:\Users\TamilselvanMuralisun\Desktop\style formatting.docx")
'If the revision is insertion type of revision, then accept it
If document.Revisions(0).RevisionType Is RevisionType.Insertions Then word.Revisions(0).Accept()
'Saves and closes the Word document
document.Save("Sample.docx", FormatType.Docx)
document.Close()
Methods
Accept()
Accepts the specified tracked change. The revision marks are removed, and the changes are incorporated into the document.
Declaration
public void Accept()
Examples
//Load an existing Word document into DocIO instance.
WordDocument document = new WordDocument("Template.docx");
//Get the revision from the revision collection and accepts.
document.Revisions[0].Accept();
//Save and Close the Word document.
document.Save("Sample.docx", FormatType.Docx);
document.Close();
'Load an existing Word document into DocIO instance.
Dim document As WordDocument = New WordDocument("Template.docx")
'Get the revision from the revision collection and accepts.
document.Revisions(0).Accept()
'Save and Close the Word document.
document.Save("Sample.docx", FormatType.Docx)
document.Close()
Reject()
Rejects the specified tracked change. The revision marks are removed, leaving the original text intact.
Declaration
public void Reject()
Examples
//Load an existing Word document into DocIO instance.
WordDocument document = new WordDocument("Template.docx");
//Get the revision from the revision collection and rejects.
document.Revisions[0].Reject();
//Save and Close the Word document.
document.Save("Sample.docx", FormatType.Docx);
document.Close();
'Load an existing Word document into DocIO instance.
Dim document As WordDocument = New WordDocument("Template.docx")
'Get the revision from the revision collection and rejects.
document.Revisions(0).Reject()
'Save and Close the Word document.
document.Save("Sample.docx", FormatType.Docx)
document.Close()