Package com.lowagie.text.rtf.table
Class RtfCell
- java.lang.Object
-
- com.lowagie.text.Rectangle
-
- com.lowagie.text.Cell
-
- com.lowagie.text.rtf.table.RtfCell
-
- All Implemented Interfaces:
Element,RtfBasicElement,RtfExtendedElement,RtfElementInterface,TextElementArray
public class RtfCell extends Cell implements RtfExtendedElement
The RtfCell wraps a Cell, but can also be added directly to a Table. The RtfCell is an extension of Cell, that supports a multitude of different borderstyles.- Version:
- $Id: RtfCell.java 3580 2008-08-06 15:52:00Z howard_s $
- Author:
- Mark Hall (Mark.Hall@mail.room3b.eu), Steffen Stundzig, Benoit Wiart, Thomas Bickel (tmb99@inode.at)
- See Also:
RtfBorder
-
-
Field Summary
Fields Modifier and Type Field Description private RtfColorbackgroundColorThe background color of this RtfCellprivate RtfBorderGroupbordersThe borders of this RtfCellprivate intcellPaddingThe padding of this RtfCellprivate floatcellPaddingBottomprivate floatcellPaddingLeftprivate floatcellPaddingRightprivate floatcellPaddingTopprivate intcellRightThe right margin of this RtfCellprivate intcellWidthThe width of this RtfCellprivate java.util.ArrayListcontentThe content of this RtfCellprivate booleandeletedWhether this RtfCell is a placeholder for a removed table cell.private RtfDocumentdocumentThe RtfDocument this RtfCell belongs toprivate booleaninHeaderWhether this RtfCell is in a headerprivate static intMERGE_NONEThis cell is not mergedprivate static intMERGE_VERT_CHILDThis cell is a child cell of a vertical merge operationprivate static intMERGE_VERT_PARENTThis cell is the parent cell of a vertical merge operationprivate intmergeTypeThe merge type of this RtfCellprivate RtfRowparentRowThe parent RtfRow of this RtfCellprivate booleanusePaddingWhether to use generic padding or individual padding values (cellPaddingLeft, cellPaddingTop, cellPaddingBottom, cellPaddingRight)-
Fields inherited from class com.lowagie.text.Cell
arrayList, colspan, groupChange, header, horizontalAlignment, maxLines, percentage, rowspan, useAscender, useBorderPadding, useDescender, verticalAlignment, width
-
Fields inherited from class com.lowagie.text.Rectangle
border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders
-
Fields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR
-
-
Constructor Summary
Constructors Modifier Constructor Description RtfCell()Constructs an empty RtfCellprotectedRtfCell(boolean deleted)Constructs a deleted RtfCell.RtfCell(Element element)Constructs a RtfCell based upon an ElementprotectedRtfCell(RtfDocument doc, RtfRow row, Cell cell)Constructs a RtfCell based on a Cell.protectedRtfCell(RtfDocument doc, RtfRow row, PdfPCell cell)Constructs a RtfCell based on a Cell.RtfCell(java.lang.String content)Constructs a RtfCell based upon a String
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RtfBorderGroupgetBorders()Gets the borders of this RtfCellprotected intgetCellpadding()Gets the cell padding of this RtfCellprotected intgetCellRight()Gets the right margin of this RtfCellprotected intgetCellWidth()Gets the cell width of this RtfCellprotected RtfColorgetRtfBackgroundColor()Get the background color of this RtfCellprivate voidimportCell(Cell cell)Imports the Cell properties into the RtfCellprivate voidimportCell(PdfPCell cell)Imports the Cell properties into the RtfCellprivate byte[]intToByteArray(int i)Transforms an integer into its String representation and then returns the bytes of that string.booleanisDeleted()Checks whether this RtfCell is a placeholder for a table cell that has been removed due to col/row spanning.booleanisInHeader()Gets whether thisRtfCellis in a headervoidsetBorders(RtfBorderGroup borderGroup)Set the borders of this RtfCellprotected voidsetCellMergeChild(RtfCell mergeParent)Merge this cell into the parent cell.protected voidsetCellRight(int cellRight)Sets the right margin of this cell.protected voidsetCellWidth(int cellWidth)Sets the cell width of this RtfCell.voidsetInHeader(boolean inHeader)Sets whether this RtfCell is in a headervoidsetInTable(boolean inTable)UnusedvoidsetRtfDocument(RtfDocument doc)Sets the RtfDocument this RtfCell belongs tovoidwriteContent(java.io.OutputStream result)Write the content of this RtfCellvoidwriteDefinition(java.io.OutputStream result)Write the cell definition part of this RtfCell-
Methods inherited from class com.lowagie.text.Cell
add, addElement, bottom, clear, createPdfPCell, getBottom, getChunks, getColspan, getElements, getGroupChange, getHorizontalAlignment, getLeading, getLeft, getMaxLines, getRight, getRowspan, getShowTruncation, getTop, getVerticalAlignment, getWidth, getWidthAsString, isEmpty, isHeader, isTable, isUseAscender, isUseBorderPadding, isUseDescender, left, process, right, setBottom, setColspan, setGroupChange, setHeader, setHorizontalAlignment, setHorizontalAlignment, setLeading, setLeft, setMaxLines, setRight, setRowspan, setShowTruncation, setTop, setUseAscender, setUseBorderPadding, setUseDescender, setVerticalAlignment, setVerticalAlignment, setWidth, setWidth, size, top, type
-
Methods inherited from class com.lowagie.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getGrayFill, getHeight, getLeft, getRight, getRotation, getTop, hasBorder, hasBorders, isContent, isNestable, isUseVariableBorders, normalize, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.lowagie.text.Element
isContent, isNestable, toString
-
-
-
-
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
-
borders
private RtfBorderGroup borders
The borders 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 torow- The RtfRow this RtfCell lies incell- 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 torow- The RtfRow this RtfCell lies incell- 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.IOExceptionWrite the cell definition part of this RtfCell- Specified by:
writeDefinitionin interfaceRtfExtendedElement- Parameters:
result- TheOutputStreamto write the element definition to- Throws:
java.io.IOException
-
writeContent
public void writeContent(java.io.OutputStream result) throws java.io.IOExceptionWrite the content of this RtfCell- Specified by:
writeContentin interfaceRtfBasicElement- Parameters:
result- TheOutputStreamto 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:
setRtfDocumentin interfaceRtfBasicElement- Parameters:
doc- The RtfDocument to use
-
setInTable
public void setInTable(boolean inTable)
Unused- Specified by:
setInTablein interfaceRtfBasicElement- Parameters:
inTable-
-
setInHeader
public void setInHeader(boolean inHeader)
Sets whether this RtfCell is in a header- Specified by:
setInHeaderin interfaceRtfBasicElement- Parameters:
inHeader-Trueif this RtfCell is in a header,falseotherwise
-
isInHeader
public boolean isInHeader()
Gets whether thisRtfCellis in a header- Returns:
Trueif thisRtfCellis in a header,falseotherwise- 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:
Trueif this RtfCell is deleted,falseotherwise.
-
-