Class Cell
Used to create table cell objects. See the Table class for more information.
public class Cell
- Inheritance
-
Cell
- Inherited Members
Remarks
The four paddings of a cell, top, bottom, left and right, are kept in one 32-bit integer, a byte each, 4 bytes for every cell where four floats would take 16:
bits 31-24 23-16 15-8 7-0
byte right left bottom top
A byte holds its padding in quarters of a point, 0 to 255, so a padding is 0 to 63.75 points in steps of 0.25, more than the text of a cell needs. A padding that is set is kept to the nearest quarter, a half up: 2.1 is kept as 2.0 and 2.13 as 2.25. One below 0, or not a number, is 0, and one above 63.75 is 63.75. A cell has a padding of 2 points on every side until it is set; SetPadding sets the four at once, and SetTopPadding and the others one each. A top of 2, a bottom of 3.5, a left of 1.25 and a right of 0 are the bytes 8, 14, 5 and 0, the integer 0x00050E08.
Constructors
Cell(Font)
Creates a cell object and sets the font.
public Cell(Font font)
Parameters
fontFontthe font.
Cell(Font, string)
Creates a cell object and sets the font and the cell text.
public Cell(Font font, string text)
Parameters
Methods
GetBackgroundColor()
Returns the background color, or null if the cell has no background.
public float[] GetBackgroundColor()
Returns
- float[]
GetBarcode()
Returns the barcode drawn in this cell, or null when the cell holds none.
public Barcode GetBarcode()
Returns
GetBorder(uint)
Returns the cell border object.
public bool GetBorder(uint border)
Parameters
borderuint
Returns
- bool
the cell border object.
GetBorderColor()
Returns the border color, or null if it is not set.
public float[] GetBorderColor()
Returns
- float[]
GetBorderWidth()
Returns the width of the cell borders.
public float GetBorderWidth()
Returns
- float
the width of the cell borders.
GetBottomPadding()
Returns the bottom padding.
public float GetBottomPadding()
Returns
GetColSpan()
Returns the column span private variable value.
public int GetColSpan()
Returns
- int
the column span value.
GetCompositeTextLine()
Returns the composite text line drawn in this cell.
public CompositeTextLine GetCompositeTextLine()
Returns
GetDrawable()
Returns the drawable inside this cell, or null.
public IDrawable GetDrawable()
Returns
GetFallbackFont()
Returns the fallback font used by this cell.
public Font GetFallbackFont()
Returns
- Font
the fallback font.
GetFont()
Returns the font used by this cell.
public Font GetFont()
Returns
- Font
the font.
GetHeight(float)
Returns the cell height.
public float GetHeight(float width)
Parameters
widthfloat
Returns
- float
the cell height.
GetImage()
Returns the cell image.
public Image GetImage()
Returns
- Image
the image, or null when the cell holds none.
GetLeftPadding()
Returns the left padding.
public float GetLeftPadding()
Returns
GetMarker()
Returns the marker drawn in this cell.
public Point GetMarker()
Returns
- Point
the point.
GetRightPadding()
Returns the right padding.
public float GetRightPadding()
Returns
GetRowSpan()
Returns the number of rows this cell spans.
public int GetRowSpan()
Returns
- int
the row span value.
GetStrikeout()
Returns true if the text is struck out.
public bool GetStrikeout()
Returns
GetText()
Returns the cell text.
public string GetText()
Returns
- string
the cell text.
GetTextAlignment()
Returns the text alignment.
public Alignment GetTextAlignment()
Returns
- Alignment
the horizontal alignment.
GetTextBlock()
Returns the text block drawn in this cell.
public TextBlock GetTextBlock()
Returns
GetTextColor()
Returns the text color.
public float[] GetTextColor()
Returns
- float[]
GetTextColumn()
Returns the text column drawn in this cell, or null when the cell holds none.
public TextColumn GetTextColumn()
Returns
GetTopPadding()
Returns the top padding.
public float GetTopPadding()
Returns
GetUnderline()
Returns true if the text is underlined.
public bool GetUnderline()
Returns
GetVerticalAlignment()
Returns the cell text vertical alignment.
public Alignment GetVerticalAlignment()
Returns
- Alignment
the vertical alignment.
GetWidth()
Returns the cell width.
public float GetWidth()
Returns
- float
the cell width.
SetBackgroundColor(int)
Sets the background color as a 0xRRGGBB value. Color.transparent removes the background.
public Cell SetBackgroundColor(int color)
Parameters
colorint
Returns
SetBackgroundColor(float[])
Sets the background color from an array of red, green and blue values, or removes the background with null. The cell keeps each component to the nearest of 256 steps.
public Cell SetBackgroundColor(float[] rgbColor)
Parameters
rgbColorfloat[]
Returns
SetBarcode(Barcode)
Sets the barcode inside this cell and clears the cell text.
public Cell SetBarcode(Barcode barcode)
Parameters
barcodeBarcodethe barcode.
Returns
- Cell
this Cell object.
SetBorder(uint, bool)
Sets the cell border object.
public Cell SetBorder(uint border, bool visible)
Parameters
Returns
- Cell
this Cell object.
SetBorderColor(int)
Sets the border color as a 0xRRGGBB value. Color.transparent draws them black, as a cell does when no color is set.
public Cell SetBorderColor(int color)
Parameters
colorint
Returns
SetBorderColor(float[])
Sets the border color from an array of red, green and blue values. The cell keeps each component to the nearest of 256 steps.
public Cell SetBorderColor(float[] rgbColor)
Parameters
rgbColorfloat[]
Returns
SetBorderWidth(float)
Sets the width of the cell borders.
public Cell SetBorderWidth(float borderWidth)
Parameters
borderWidthfloatthe width of the cell borders.
Returns
- Cell
this Cell object.
SetBorders(bool)
Sets all cell borders.
public Cell SetBorders(bool borders)
Parameters
bordersbooltrue or false.
Returns
- Cell
this Cell object.
SetBottomPadding(float)
Sets the bottom padding of this cell.
public Cell SetBottomPadding(float padding)
Parameters
paddingfloatthe bottom padding.
Returns
SetColSpan(int)
Sets the number of columns this cell spans, counted from this one. A column span of less than 1 is 1, and one past the end of its row spans the columns the row has left.
public Cell SetColSpan(int colspan)
Parameters
colspanintthe specified column span value, from 1.
Returns
SetCompositeTextLine(CompositeTextLine)
Sets the composite text line drawn in this cell.
public Cell SetCompositeTextLine(CompositeTextLine compositeTextLine)
Parameters
compositeTextLineCompositeTextLine
Returns
SetDrawable(IDrawable)
Sets the drawable inside this cell and clears the cell text. A cell holds one drawable, so this replaces the image, barcode, text block or text column set before. The drawable is placed by its top left corner, at the padding, and aligned in the cell as the text is; it is measured with DrawOn(null). A text block gets the width of the cell.
public Cell SetDrawable(IDrawable drawable)
Parameters
drawableIDrawablethe drawable, for example a QRCode, an SVGImage or a Table.
Returns
- Cell
this Cell object.
SetFallbackFont(Font)
Sets the fallback font for this cell.
public Cell SetFallbackFont(Font fallbackFont)
Parameters
fallbackFontFontthe fallback font.
Returns
- Cell
this Cell object.
SetFont(Font)
Sets the font for this cell. The font size does not change; set it with SetFontSize. The fallback font changes with the font, unless a different fallback font was set.
public Cell SetFont(Font font)
Parameters
fontFontthe font.
Returns
- Cell
this Cell object.
SetFontSize(float)
Sets the font size.
public Cell SetFontSize(float fontSize)
Parameters
fontSizefloat
Returns
SetImage(Image)
Sets the image inside this cell and clears the cell text.
public Cell SetImage(Image image)
Parameters
imageImagethe image.
Returns
- Cell
this Cell object.
SetLeftPadding(float)
Sets the left padding of this cell.
public Cell SetLeftPadding(float padding)
Parameters
paddingfloatthe left padding.
Returns
SetMarker(Point, Alignment)
Sets the marker drawn in this cell: a Point, placed at the left or the right of the cell and centered vertically. See the Point class and Example_26 for more information.
public Cell SetMarker(Point point, Alignment alignment)
Parameters
Returns
- Cell
this Cell object.
SetPadding(float)
Sets the top, bottom, left and right paddings of this cell.
public Cell SetPadding(float padding)
Parameters
paddingfloatthe right padding.
Returns
SetRightPadding(float)
Sets the right padding of this cell.
public Cell SetRightPadding(float padding)
Parameters
paddingfloatthe right padding.
Returns
SetRowSpan(int)
Sets the number of rows this cell spans, counted from this one, so that a row span of 2 covers this row and the one under it. The cells the span covers are not drawn: this cell draws its text, its background and its borders once over all of them, and a page break moves the whole of it to the next page. The table keeps its shape, so the rows under this one still hold a cell at this column, which is left empty. A row span of 1, the default, spans nothing. Please see Example_21.
public Cell SetRowSpan(int rowspan)
Parameters
rowspanintthe number of rows, from 1.
Returns
- Cell
this Cell object.
SetStrikeout(bool)
Sets whether the text is struck out.
public Cell SetStrikeout(bool strikeout)
Parameters
strikeoutbool
Returns
SetText(string)
Sets the cell text.
public Cell SetText(string text)
Parameters
textstringthe cell text.
Returns
- Cell
this Cell object.
SetTextAlignment(Alignment)
Sets the cell text alignment.
public Cell SetTextAlignment(Alignment alignment)
Parameters
alignmentAlignmentthe alignment. Supported values: Alignment.LEFT, Alignment.RIGHT, Alignment.CENTER and Alignment.JUSTIFY, which draws the single line of cell text left aligned.
Returns
SetTextBlock(TextBlock)
Sets the text block drawn in this cell and clears the cell text.
public Cell SetTextBlock(TextBlock textBlock)
Parameters
textBlockTextBlock
Returns
SetTextColor(int)
Sets the text color as a 0xRRGGBB value. Color.transparent leaves the text color unchanged.
public Cell SetTextColor(int color)
Parameters
colorint
Returns
SetTextColor(float[])
Sets the text color from an array of red, green and blue values. The cell keeps each component to the nearest of 256 steps. A null color leaves the text color unchanged, as Color.transparent does.
public Cell SetTextColor(float[] rgbColor)
Parameters
rgbColorfloat[]
Returns
SetTextColumn(TextColumn)
Sets the text column drawn in this cell, widens the cell to fit it and clears the cell text.
public Cell SetTextColumn(TextColumn textColumn)
Parameters
textColumnTextColumn
Returns
SetTopPadding(float)
Sets the top padding of this cell.
public Cell SetTopPadding(float padding)
Parameters
paddingfloatthe top padding.
Returns
SetURIAction(string)
Sets the URI opened when this cell is clicked.
public Cell SetURIAction(string uri)
Parameters
uristring
Returns
SetUnderline(bool)
Sets the underline variable. If the value of the underline variable is 'true' - the text is underlined.
public Cell SetUnderline(bool underline)
Parameters
underlineboolthe underline flag.
Returns
- Cell
this Cell object.
SetVerticalAlignment(Alignment)
Sets the cell text vertical alignment.
public Cell SetVerticalAlignment(Alignment alignment)
Parameters
alignmentAlignmentthe alignment. Supported values: Alignment.TOP, Alignment.CENTER and Alignment.BOTTOM.
Returns
- Cell
this Cell object.
SetWidth(float)
Sets the width of this cell.
public Cell SetWidth(float width)
Parameters
widthfloatthe specified width.
Returns
- Cell
this Cell object.