Aspose Words export Comment and Revision author

When generating a PDF from a Word document (docx) I’d like to include the author name of the comment or revision in the revision bubble. I don’t see an option for that and it appears the default doesn’t include the author name. I’ve attached a copy of the docx and the generated PDF using Aspose Words for Java.aspose-ticket-word-revision-author.zip (33.9 KB)

I’m setting Document.setShowComments to true and Document.layoutOptions.revisionOptions.showInBallons = ShowInBallons.FORMAT

@tucker.barbour

Please note that Aspose.Words mimics the behavior of MS Word. If you perform the same scenario using MS Word, you will get the same output. However, you can use following code example to achieve your desired output. Hope this helps you.

Document doc = new Document("word-doc-with-revisions.docx");
NodeCollection comments = doc.getChildNodes(NodeType.COMMENT, true);

for (Comment comment : (Iterable<Comment>) comments)
{
    comment.setInitial(comment.getAuthor());
}
doc.getLayoutOptions().setCommentDisplayMode(CommentDisplayMode.SHOW_IN_BALLOONS);
doc.save(MyDir + "21.10.pdf");

Thanks for the quick response. This gets me most of the way to what I was looking for. However, I’m still seeing the text “Commented” and what appears to be a comment “index” after the initial.

Screenshot 2021-10-18 at 16.44.57.png (9.2 KB)

Is there a way to customise the text here? I think ideally, it would just include the author name.

@tucker.barbour

You are facing the expected behavior of Aspose.Words. When saving the document(.docx) to any fixed-page format (such as PDF, XPS), MS Word renders comment’s prefix as follows (consider a simple case):

" Commented [Initials+CommentNumber] ",

where Initials — the text from property “w:initials”, CommentNumber — a number of this comment in the order it appears in the document.

Thanks for the follow-up. Understanding this is expected behaviour and mimics the behaviour from MS Word is helpful. I think this can be resolved. Thank you again for the help.

@tucker.barbour

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.