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

Free Support Forum - aspose.com

Aspose.Words for .NET Revision Locations and Position

Hi

I am comparing two work documents and can loop through all of the revisions in the revisioncollections.

How do i find which paragraph the revision is in and at what the position within the paragraph is

Thanks

Hi there,


Thanks for your inquiry.
How do i find which paragraph the revision is in

Please use Revision.ParentNode property to get the immediate parent node (owner) of this revision. You can check the node type either it is Run or Paragraph. Please check following code example.

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

foreach (Revision revision in doc.Revisions)

{

if (revision.ParentNode.NodeType == NodeType.Paragraph)

{

Paragraph para = (Paragraph)revision.ParentNode;

}

}

david.hancock@imagefast.co.uk:
at what the position within the paragraph is
Could you please share some more detail about this query? We will then provide you more information on this along with code.


Thanks for the info around the working out the paragraph.

Basically we are building a web app, the user will pick 2 word documents.

The 2 word documents will be compared, once compared the results will be rendered to a web browser

Within the web browser UI, the left had side of the web page will a show html table with a high level of summary any differences

e.g.
Type (insertion/deletion), What the change was (the text), location, link to the change in the document

On the right hand side a html render compared document will be displayed.

Looking at the Revisions collection, I can capture the type (Insertion/Deletion), the paragraph where the change is (thanks for the help there)

How do i find out what the actual revision change is e.g. the extract text inserted or deleted) and at what position revision is with in the paragraph

Once we have the revision text location in the paragraph, is it possible to make this into a link/anchor/target so we can scroll to the location in code

Thanks



Hi there,


Thanks for sharing the detail. You may check Aspose.Words document comparison feature. Please read following article for your kind reference.
How to Compare Two Word Documents

You can use the following properties to determine if a Paragraph and/or the child node (Run) have what revisions:

Paragraph/Run.IsDeleteRevision property
Paragraph/Run.IsFormatRevision property
Paragraph/Run.IsInsertRevision property
Once we have the revision text location in the paragraph, is it possible to make this into a link/anchor/target so we can scroll to the location in code
A paragraph can contain any number of inline-level nodes and bookmarks e.g. Run, Shape etc. If a Run node has revision, you can check it using above mentioned properties and insert link at the position of Run node. However, the contents will be inserted as insert revision in the document.