com.aspose.words

Class CommentDisplayMode

  • java.lang.Object
    • com.aspose.words.CommentDisplayMode
public class CommentDisplayMode 
extends java.lang.Object

Utility class containing constants. Specifies the rendering mode for document comments.

Example:

Shows how to show comments when saving a document to a rendered format.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.write("Hello world!");

Comment comment = new Comment(doc, "John Doe", "J.D.", new Date());
comment.setText("My comment.");
builder.getCurrentParagraph().appendChild(comment);

// ShowInAnnotations is only available in Pdf1.7 and Pdf1.5 formats.
// In other formats, it will work similarly to Hide.
doc.getLayoutOptions().setCommentDisplayMode(CommentDisplayMode.SHOW_IN_ANNOTATIONS);

doc.save(getArtifactsDir() + "Document.ShowCommentsInAnnotations.pdf");

// Note that it's required to rebuild the document page layout (via Document.UpdatePageLayout() method)
// after changing the Document.LayoutOptions values.
doc.getLayoutOptions().setCommentDisplayMode(CommentDisplayMode.SHOW_IN_BALLOONS);
doc.updatePageLayout();

doc.save(getArtifactsDir() + "Document.ShowCommentsInBalloons.pdf");

Field Summary
static final intHIDE = 0
No document comments are rendered.
static final intSHOW_IN_BALLOONS = 1
Renders document comments in balloons in the margin. This is the default value.
static final intSHOW_IN_ANNOTATIONS = 2
Renders document comments in annotations. This is only available for Pdf format.
 

    • Field Detail

      • HIDE = 0

        public static final int HIDE
        No document comments are rendered.
      • SHOW_IN_BALLOONS = 1

        public static final int SHOW_IN_BALLOONS
        Renders document comments in balloons in the margin. This is the default value.
      • SHOW_IN_ANNOTATIONS = 2

        public static final int SHOW_IN_ANNOTATIONS
        Renders document comments in annotations. This is only available for Pdf format.