Class RtfCell

    • Field Detail

      • MERGE_NONE

        private static final int MERGE_NONE
        This cell is not merged
        See Also:
        Constant Field Values
      • MERGE_VERT_PARENT

        private static final int MERGE_VERT_PARENT
        This cell is the parent cell of a vertical merge operation
        See Also:
        Constant Field Values
      • MERGE_VERT_CHILD

        private static final int MERGE_VERT_CHILD
        This cell is a child cell of a vertical merge operation
        See Also:
        Constant Field Values
      • parentRow

        private RtfRow parentRow
        The parent RtfRow of this RtfCell
      • content

        private java.util.ArrayList content
        The content of this RtfCell
      • cellRight

        private int cellRight
        The right margin of this RtfCell
      • cellWidth

        private int cellWidth
        The width of this RtfCell
      • backgroundColor

        private RtfColor backgroundColor
        The background color of this RtfCell
      • cellPadding

        private int cellPadding
        The padding of this RtfCell
      • mergeType

        private int mergeType
        The merge type of this RtfCell
      • document

        private RtfDocument document
        The RtfDocument this RtfCell belongs to
      • inHeader

        private boolean inHeader
        Whether this RtfCell is in a header
      • deleted

        private boolean deleted
        Whether this RtfCell is a placeholder for a removed table cell.
      • usePadding

        private boolean usePadding
        Whether to use generic padding or individual padding values (cellPaddingLeft, cellPaddingTop, cellPaddingBottom, cellPaddingRight)
      • cellPaddingLeft

        private float cellPaddingLeft
      • cellPaddingTop

        private float cellPaddingTop
      • cellPaddingBottom

        private float cellPaddingBottom
      • cellPaddingRight

        private float cellPaddingRight
    • Constructor Detail

      • RtfCell

        public RtfCell()
        Constructs an empty RtfCell
      • RtfCell

        public RtfCell​(java.lang.String content)
        Constructs a RtfCell based upon a String
        Parameters:
        content - The String to base the RtfCell on
      • RtfCell

        public RtfCell​(Element element)
                throws BadElementException
        Constructs a RtfCell based upon an Element
        Parameters:
        element - The Element to base the RtfCell on
        Throws:
        BadElementException - If the Element is not valid
      • RtfCell

        protected RtfCell​(boolean deleted)
        Constructs a deleted RtfCell.
        Parameters:
        deleted - Whether this RtfCell is actually deleted.
      • RtfCell

        protected RtfCell​(RtfDocument doc,
                          RtfRow row,
                          Cell cell)
        Constructs a RtfCell based on a Cell.
        Parameters:
        doc - The RtfDocument this RtfCell belongs to
        row - The RtfRow this RtfCell lies in
        cell - The Cell to base this RtfCell on
      • RtfCell

        protected RtfCell​(RtfDocument doc,
                          RtfRow row,
                          PdfPCell cell)
        Constructs a RtfCell based on a Cell.
        Parameters:
        doc - The RtfDocument this RtfCell belongs to
        row - The RtfRow this RtfCell lies in
        cell - The PdfPCell to base this RtfCell on
        Since:
        2.1.3
    • Method Detail

      • importCell

        private void importCell​(Cell cell)
        Imports the Cell properties into the RtfCell
        Parameters:
        cell - The Cell to import
      • importCell

        private void importCell​(PdfPCell cell)
        Imports the Cell properties into the RtfCell
        Parameters:
        cell - The PdfPCell to import
        Since:
        2.1.3
      • writeDefinition

        public void writeDefinition​(java.io.OutputStream result)
                             throws java.io.IOException
        Write the cell definition part of this RtfCell
        Specified by:
        writeDefinition in interface RtfExtendedElement
        Parameters:
        result - The OutputStream to write the element definition to
        Throws:
        java.io.IOException
      • writeContent

        public void writeContent​(java.io.OutputStream result)
                          throws java.io.IOException
        Write the content of this RtfCell
        Specified by:
        writeContent in interface RtfBasicElement
        Parameters:
        result - The OutputStream to write the content to
        Throws:
        java.io.IOException
      • setCellRight

        protected void setCellRight​(int cellRight)
        Sets the right margin of this cell. Used in merge operations
        Parameters:
        cellRight - The right margin to use
      • getCellRight

        protected int getCellRight()
        Gets the right margin of this RtfCell
        Returns:
        The right margin of this RtfCell.
      • setCellWidth

        protected void setCellWidth​(int cellWidth)
        Sets the cell width of this RtfCell. Used in merge operations.
        Parameters:
        cellWidth - The cell width to use
      • getCellWidth

        protected int getCellWidth()
        Gets the cell width of this RtfCell
        Returns:
        The cell width of this RtfCell
      • getCellpadding

        protected int getCellpadding()
        Gets the cell padding of this RtfCell
        Returns:
        The cell padding of this RtfCell
      • getBorders

        protected RtfBorderGroup getBorders()
        Gets the borders of this RtfCell
        Returns:
        The borders of this RtfCell
      • setBorders

        public void setBorders​(RtfBorderGroup borderGroup)
        Set the borders of this RtfCell
        Parameters:
        borderGroup - The RtfBorderGroup to use as borders
      • getRtfBackgroundColor

        protected RtfColor getRtfBackgroundColor()
        Get the background color of this RtfCell
        Returns:
        The background color of this RtfCell
      • setCellMergeChild

        protected void setCellMergeChild​(RtfCell mergeParent)
        Merge this cell into the parent cell.
        Parameters:
        mergeParent - The RtfCell to merge with
      • setRtfDocument

        public void setRtfDocument​(RtfDocument doc)
        Sets the RtfDocument this RtfCell belongs to
        Specified by:
        setRtfDocument in interface RtfBasicElement
        Parameters:
        doc - The RtfDocument to use
      • setInTable

        public void setInTable​(boolean inTable)
        Unused
        Specified by:
        setInTable in interface RtfBasicElement
        Parameters:
        inTable -
      • setInHeader

        public void setInHeader​(boolean inHeader)
        Sets whether this RtfCell is in a header
        Specified by:
        setInHeader in interface RtfBasicElement
        Parameters:
        inHeader - True if this RtfCell is in a header, false otherwise
      • isInHeader

        public boolean isInHeader()
        Gets whether this RtfCell is in a header
        Returns:
        True if this RtfCell is in a header, false otherwise
        Since:
        2.1.0
      • intToByteArray

        private byte[] intToByteArray​(int i)
        Transforms an integer into its String representation and then returns the bytes of that string.
        Parameters:
        i - The integer to convert
        Returns:
        A byte array representing the integer
      • isDeleted

        public boolean isDeleted()
        Checks whether this RtfCell is a placeholder for a table cell that has been removed due to col/row spanning.
        Returns:
        True if this RtfCell is deleted, false otherwise.