Class CommentUtil

java.lang.Object
org.wickedsource.docxstamper.util.CommentUtil

public class CommentUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static org.docx4j.wml.Comments.Comment
    getCommentAround(org.docx4j.wml.R run, org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
    Returns the comment the given DOCX4J run is commented with.
    static org.docx4j.wml.Comments.Comment
    getCommentFor(org.docx4j.wml.ContentAccessor object, org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
    Returns the first comment found for the given docx object.
    getComments(org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
     
    static String
    getCommentString(org.docx4j.wml.Comments.Comment comment)
    Returns the string value of the specified comment object.
    static String
    getCommentStringFor(org.docx4j.wml.ContentAccessor object, org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCommentAround

      public static org.docx4j.wml.Comments.Comment getCommentAround(org.docx4j.wml.R run, org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
      Returns the comment the given DOCX4J run is commented with.
      Parameters:
      run - the DOCX4J run whose comment to retrieve.
      document - the document that contains the run.
      Returns:
      the comment, if found, null otherwise.
    • getCommentFor

      public static org.docx4j.wml.Comments.Comment getCommentFor(org.docx4j.wml.ContentAccessor object, org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
      Returns the first comment found for the given docx object. Note that an object is only considered commented if the comment STARTS within the object. Comments spanning several objects are not supported by this method.
      Parameters:
      object - the object whose comment to load.
      document - the document in which the object is embedded (needed to load the comment from the comments.xml part).
      Returns:
      the concatenated string of all paragraphs of text within the comment or null if the specified object is not commented.
      Throws:
      org.docx4j.openpackaging.exceptions.Docx4JException - in case of a Docx4J processing error.
    • getCommentStringFor

      public static String getCommentStringFor(org.docx4j.wml.ContentAccessor object, org.docx4j.openpackaging.packages.WordprocessingMLPackage document) throws org.docx4j.openpackaging.exceptions.Docx4JException
      Throws:
      org.docx4j.openpackaging.exceptions.Docx4JException
    • getCommentString

      public static String getCommentString(org.docx4j.wml.Comments.Comment comment)
      Returns the string value of the specified comment object.
    • deleteComment

      public static void deleteComment(CommentWrapper comment)
    • getComments

      public static Map<BigInteger,CommentWrapper> getComments(org.docx4j.openpackaging.packages.WordprocessingMLPackage document)