Create pre-existing revisions while creating a document

Hello,
I would like to know if it is possible to create revisions while creating a document.
In this scenario, we have text1 from source1 and text2 from source2 and I can already obtain the diff information externally. I would like to use my diff information to drive the creation of a given sentence (a collection of runs) in Words that will result in a pre-existing revision in the output document that can then be further accepted/rejected like any other revision.
Thanks

Hi Bill,

Thanks for your inquiry. You can check Document.Revisions property to determine what revisions are present in a Document. Moreover, following public methods were added to start/stop automatic revision tracking.

Document.StartTrackRevisions(string author, DateTime dateTime);
Document.StartTrackRevisions(string author);
Document.StopTrackRevisions();

Note that these methods has no correlation this Document.TrackRevisions property so setting this property has no effect to Aspose.Words. You should explicitly call StartTrackRevision method to start automatically revision tracking in Aspose.Words.

Currently formatting changes are not tracked.

There are few limitation in current implementation. Revision tracking is suspended (node changes are not tracked) during the following methods:

  1. field updating - Document.UpdateFields() method
  2. field insertion - DocumentBuilder.InsertField() method
  3. text replace - Range.Replace() method
  4. mail merge - MailMerge.Execute() method.

Use case:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("hello"); // this is not tracked

doc.startTrackRevisions("user1");
builder.writeln("message from user1"); // this is marked as inserted by user1

doc.startTrackRevisions("user2");
builder.writeln("comment from user2"); // this is marked as inserted by user2

doc.startTrackRevisions("user3", DateTime.Now);
doc.removeAllChildren(); // both paragraphs inserted above are marked as deleted

doc.stopTrackRevisions();

builder.writeln("let’s start it all over"); // this is not marked because tracking has been stopped.

I hope, this helps in achieving what you’re looking for.

Best regards,

That is indeed close. I will need to write formatted text. But tracking changes to formatting is not needed. I will be writing one line per cell within a table. I’ll play around more to see if it will work for my overall needs.
Thank you!

Hi Bill,

Thanks for your inquiry. Please let us know if you have any troubles and we will be glad to look into this further for you.

Best regards,