Class XWPFComment

java.lang.Object
org.apache.poi.xwpf.usermodel.XWPFComment
All Implemented Interfaces:
IBody

public class XWPFComment extends Object implements IBody
Sketch of XWPF comment class
  • Constructor Details

  • Method Details

    • getPart

      public POIXMLDocumentPart getPart()
      Get the Part to which the comment belongs, which you need for adding relationships to other parts
      Specified by:
      getPart in interface IBody
      Returns:
      POIXMLDocumentPart that contains the comment.
      See Also:
    • getPartType

      public BodyType getPartType()
      Get the part type BodyType of the comment.
      Specified by:
      getPartType in interface IBody
      Returns:
      The BodyType value.
      See Also:
    • getBodyElements

      public List<IBodyElement> getBodyElements()
      Gets the body elements (IBodyElement) of the comment.
      Specified by:
      getBodyElements in interface IBody
      Returns:
      List of body elements.
    • getParagraphs

      public List<XWPFParagraph> getParagraphs()
      Returns the paragraph(s) that holds the text of the comment.
      Specified by:
      getParagraphs in interface IBody
    • getTables

      public List<XWPFTable> getTables()
      Get the list of XWPFTables in the comment.
      Specified by:
      getTables in interface IBody
      Returns:
      List of tables
    • getParagraph

      public XWPFParagraph getParagraph(CTP p)
      Description copied from interface: IBody
      Returns the paragraph corresponding to the provided CTP.
      Specified by:
      getParagraph in interface IBody
      Parameters:
      p - is instance of CTP and is searching for an XWPFParagraph
      Returns:
      The paragraph corresponding to the CTP, or null if there is no corresponding paragraph in this body.
    • getTable

      public XWPFTable getTable(CTTbl ctTable)
      Description copied from interface: IBody
      if there is a corresponding XWPFTable of the parameter ctTable in the tableList of this header the method will return this table if there is no corresponding XWPFTable the method will return null
      Specified by:
      getTable in interface IBody
    • getParagraphArray

      public XWPFParagraph getParagraphArray(int pos)
      Description copied from interface: IBody
      Returns the paragraph that of position pos
      Specified by:
      getParagraphArray in interface IBody
    • getTableArray

      public XWPFTable getTableArray(int pos)
      Description copied from interface: IBody
      Returns the table at position pos
      Specified by:
      getTableArray in interface IBody
    • insertNewParagraph

      public XWPFParagraph insertNewParagraph(XmlCursor cursor)
      Description copied from interface: IBody
      inserts a new paragraph at position of the cursor
      Specified by:
      insertNewParagraph in interface IBody
    • insertNewTbl

      public XWPFTable insertNewTbl(XmlCursor cursor)
      Description copied from interface: IBody
      inserts a new Table at the cursor position.
      Specified by:
      insertNewTbl in interface IBody
    • insertTable

      public void insertTable(int pos, XWPFTable table)
      Description copied from interface: IBody
      inserts a new Table at position pos
      Specified by:
      insertTable in interface IBody
    • getTableCell

      public XWPFTableCell getTableCell(CTTc cell)
      Description copied from interface: IBody
      returns the TableCell to which the Table belongs
      Specified by:
      getTableCell in interface IBody
    • getXWPFDocument

      public XWPFDocument getXWPFDocument()
      Get the XWPFDocument the comment is part of.
      Specified by:
      getXWPFDocument in interface IBody
      See Also:
    • getText

      public String getText()
    • createParagraph

      public XWPFParagraph createParagraph()
    • removeParagraph

      public void removeParagraph(XWPFParagraph paragraph)
    • removeTable

      public void removeTable(XWPFTable table)
    • createTable

      public XWPFTable createTable(int rows, int cols)
    • getCtComment

      public CTComment getCtComment()
      Gets the underlying CTComment object for the comment.
      Returns:
      CTComment object
    • getComments

      public XWPFComments getComments()
      The owning object for this comment
      Returns:
      The XWPFComments object that contains this comment.
    • getId

      public String getId()
      Get a unique identifier for the current comment. The restrictions on the id attribute, if any, are defined by the parent XML element. If this attribute is omitted, then the document is non-conformant.
      Returns:
      string id
    • getAuthor

      public String getAuthor()
      Get the author of the current comment
      Returns:
      author of the current comment
    • setAuthor

      public void setAuthor(String author)
      Specifies the author for the current comment If this attribute is omitted, then no author shall be associated with the parent annotation type.
      Parameters:
      author - author of the current comment
    • getInitials

      public String getInitials()
      Get the initials of the author of the current comment
      Returns:
      initials the initials of the author of the current comment
    • setInitials

      public void setInitials(String initials)
      Specifies the initials of the author of the current comment
      Parameters:
      initials - the initials of the author of the current comment
    • getDate

      public Calendar getDate()
      Get the date information of the current comment
      Returns:
      the date information for the current comment.
    • setDate

      public void setDate(Calendar date)
      Specifies the date information for the current comment. If this attribute is omitted, then no date information shall be associated with the parent annotation type.
      Parameters:
      date - the date information for the current comment.