We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can you relate Revisions.Groups to a Revision

Hi,

Is it possible to relate the Document.Revisions.Groups to Document.Revisions?
Or can you get the text that was deleted in a Document.Revisions?

I am trying to get the Date, Author, RevisionType and Text affected from a Word document. With Revisions.Groups I cannot get the Date, and with Document.Revisions I can get the Date, but not the text that was removed by a Deletion.

Thanks,
Charles

@ccuster68

A revision in Aspose.Words is a change in one document node. A set of sequential revisions of the same type in adjacent document nodes forms a revision group. Similar revision groups are displayed in the “Reviewing Pane” of MS Word.

You can get the revision group by using Document.Revisions.Groups property and all revision of document using Document.Revisions property.

If you want to get the deleted text in group revision, you can get it by RevisionGroup.Text property and check deleted type using RevisionGroup.RevisionType.

You can also get the deleted text revision using Run.Text property when Run.IsDeleteRevision is true.

We suggest you please read the following articles.
Programmatically Access Revisions
Access Revision Group

Moreover, please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + "input.docx");

foreach (Revision revision in doc.Revisions)
{
    if (revision.ParentNode.NodeType == NodeType.Run && ((Run)revision.ParentNode).IsDeleteRevision)
    {
        Console.WriteLine(revision.ParentNode.ToString(SaveFormat.Text));
    }
}

Hi Tahir,

Thank you for the clarification. I am also trying to get the text for the FormatChange revision type.
I can see the Format Description text in Document.Revisions.Groups[i].Text property. The issue is that I do not get the date associated with it. I cannot see this information in the Document.Revisions. Can you help with this?

Thanks,
Charles.

@ccuster68

Could you please ZIP and attach your input document along with expected output here for our reference? We will then provide you more information about your query.

Hi Tahir,

I included the files. Ideally I would like to use the Document.Revisions.Groups if it had a date associated (or even date range, or someway to relate the Group to the revisions to obtain a date.)

Thanks
Charles
FormatDescription.zip (118.6 KB)

@ccuster68

With RevisionGroup class, you can get the similar revision groups are displayed in the “Reviewing Pane” of MS Word. Please check the following image.

You can get the date/time of a revision using Revision.DateTime property. So, please use members of Revision class to achieve your requirement.

Hi Tahir,

I realize that the info is available in both Revisions and Groups. What I do not know is how I tie them together so I can show the the Text of the revision (Font:Bole, Italic, Underline) and the date of the revision. Notice in word they show both. They have both the Format Description and the date (in this case yesterday), but if not yesterday it shows the date as in second example picture.
image.png (2.4 KB)

image.png (1.9 KB)

Is there a way in Aspose to relate the Date and the Format Description?

Thanks,
Charles

@ccuster68

Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-18418 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@ccuster68

Please note that we cannot implement RevisionGroup.Date as you requested because group might contain revisions with different dates.

Will you be satisfied if we just expose collection of Revision objects for each RevisionGroup? Please share your feedback on it. Thanks for your cooperation.

@tahir.manzoor,

Yes I think I should be able to create my relations if I had this information.

@ccuster68

Thanks for your feedback. We will expose collection of Revision objects for each RevisionGroup. We will inform you via this forum thread once this feature is available.

The issues you have found earlier (filed as WORDSNET-18418) have been fixed in this Aspose.Words for .NET 19.7 update and this Aspose.Words for Java 19.7 update.

@ccuster68,

It is to update you that we have also added a new property named Revision.Group in the scope of WORDSNET-18418 that you can use on your end. Sample use-case is as follows:

Document doc = new Document(@"source.docx");
 
foreach (Revision revision in doc.Revisions)
{
    string groupText = revision.Group != null
        ? "Revision group text: " + revision.Group.Text
        : "Revision has no group";
 
    Console.WriteLine("Type: " + revision.RevisionType);
    Console.WriteLine("Author: " + revision.Author);
    Console.WriteLine("Date: " + revision.DateTime);
    Console.WriteLine("Revision text: " + revision.ParentNode.ToString(SaveFormat.Text));
    Console.WriteLine(groupText);
}