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

Free Support Forum - aspose.com

Accpeting revisions for Specific Table

Hello Support,

I have a document with multiple tables in it. I want to accept revisions for specific table. Table position will vary and it will have specific bookmark to identify that its revisions needs to be accepted. Also revisions related to shape types only needs to be accepted.

How to this?

At the root I want to know how to access revisions for specific tables?

I tried with below code deleting run will not help as I want to accept the revision.

NodeCollection runs = tb.GetChildNodes(NodeType.Run, true);

foreach (Run run in runs)

{

if (run.IsDeleteRevision)

{

if (run.NodeType==NodeType.Shape)

{

// how to accept the revision for this run?

}

}

}

Thanks in advance. I am opene to any other method to solve the need.

Regards
Mandar

Hi Mandar,


Thanks for your inquiry. Please use following code example to achieve your requirements. Hope this helps you.

Document doc = new Document(MyDir + “in.docx”);<o:p></o:p>

for (int idx = doc.Revisions.Count - 1; idx >= 0; idx--)

{

Revision revision = doc.Revisions[idx];

Table table = (Table)revision.ParentNode.GetAncestor(NodeType.Table);

if (table != null)

{

revision.Accept();

}

}

doc.Save(MyDir + "17.4.docx");

Hello Support,
This will not help, I want to accept revisions for specific table. Table position will vary
and it will have specific bookmark to identify that its revisions needs
to be accepted. Also revisions related to shape types only needs to be
accepted.
Is there any other way to access revisions than at document level.
In word we can access revisions for range of anything, like table.range.revisions or Shape[0].revisions.

Here it seems that it is possible to access revisiosn only at document level.

Regards
Mandar

Hi Mandar,

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

We apologize for your inconvenience.

Hi Mandar,

Following code example shows how to accept tracked changes for a table that contains bookmark named "mybookmark". Please use the same approach to accept the the tracked changes for specific Table node. Hope this helps you.

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

Bookmark bm = doc.Range.Bookmarks["mybookmark"];

Table bmtable = (Table)bm.BookmarkStart.GetAncestor(NodeType.Table);

for (int idx = doc.Revisions.Count - 1; idx >= 0; idx--)

{

Revision revision = doc.Revisions[idx];

Table table = (Table)revision.ParentNode.GetAncestor(NodeType.Table);

if (table != null && bmtable.Equals(table))

{

revision.Accept();

}

}

doc.Save(MyDir + "17.4.docx");

Hello Support,

I will try with this. This will work for Row object as well, Correct?

Regards
Mandar

Hi Mandar,

Thanks for your inquiry. Yes, you can use the same approach to accept track changes for table's row. You just need to change Table node with Row node.

Please let us know if you have any more queries.