Retrieving review comments from MS Word

Hi, I am using Aspose.Words for java to read the review comments from a MS Word document. I need the following details,

1. How can get the begin line number of each Comment node?
2. How can get the commented text?
3. How can get the status of each review comments like it is accepted or rejected?

Thanks & regards,
Dheepan.

Hi Dheepan,

Thanks for your inquiry. Tracked changes are imported into the model as regular nodes. Paragraphs, Runs and Shapes all provide special properties to specify if they are insert or delete revisions.

You can work with each these revisions manually or choose to accept all revisions at once. Using Aspose.Words you can set tracked changes to be on or off. Note however that any changes made in the DOM using Aspose.Words are not recorded as tracked changes.

You may need to accept tracked changes before saving to different formats or else the deleted revisions will still show up in the output document. Currently only Insert and Delete revisions are made available in the public API. Also Move and some Table revisions are unsupported. Additionally formatting changes are also unsupported.

These additional features will be included in a future version as well as an API to easily retrieve revisions by author, date etc.

See the following links in the documentation for further information:
https://docs.aspose.com/words/java/track-changes-in-a-document/

rdheepan:

  1. How can get the begin line number of each Comment node?

Please note that MS Word document is flow document and does not contain any information about its layout into lines and pages. However, Aspose.Words provides basic access to the layout engine through the LayoutCollector and LayoutEnumerator classes.

Please check using the DocumentLayoutHelper sample from the offline samples pack . This sample demonstrates how to easily work with the layout elements of a document and access the pages, lines, spans etc.

The DocumentLayoutHelper’s code for Java is not available at the moment. I have logged a new Task for this in our issue tracking system as WORDSJAVA-740. Your request has been linked to this Task. We will update you via this forum thread once the code sample of DocumentLayoutHelper is available.

rdheepan:

  1. How can get the commented text?

All text of the document is stored in runs of text. Run.isDeleteRevision returns true if this object was deleted in Microsoft Word while change tracking was enabled. Run.isInsertRevision returns true if this object was inserted in Microsoft Word while change tracking was enabled. You can get the text of Run nodes which has revision by using Run.toString(SaveFormat.TEXT).

You can extract comments and commented text by using Aspose.Words. You can extract commented text by extracting text of nodes between CommentRangeStart and CommentRangeEnd.

Please also read following documentation link to extract the comments.
https://docs.aspose.com/words/net/working-with-comments/

rdheepan:
3. How can get the status of each review comments like it is accepted or rejected?

Could you please share some more detail about your query? You can accept a revision by Revision.accept method and reject a revision by Revision.Reject. Document.getRevisions return a of revisions (tracked changes) that exist in this document.

Hi Dheepan,


Thanks for being patient. Please try the attached DocumentLayoutHelper utility for Java. I hope, this helps.

The issues you have found earlier (filed as WORDSJAVA-740) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(4)