Table of Contents

Class Cell

Namespace
PDFjet.NET
Assembly
PDFjet.dll

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

font Font

the font.

Cell(Font, string)

Creates a cell object and sets the font and the cell text.

public Cell(Font font, string text)

Parameters

font Font

the font.

text string

the text.

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

Barcode

GetBorder(uint)

Returns the cell border object.

public bool GetBorder(uint border)

Parameters

border uint

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

float

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

CompositeTextLine

GetDrawable()

Returns the drawable inside this cell, or null.

public IDrawable GetDrawable()

Returns

IDrawable

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

width float

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

float

GetMarker()

Returns the marker drawn in this cell.

public Point GetMarker()

Returns

Point

the point.

GetRightPadding()

Returns the right padding.

public float GetRightPadding()

Returns

float

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

bool

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

TextBlock

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

TextColumn

GetTopPadding()

Returns the top padding.

public float GetTopPadding()

Returns

float

GetUnderline()

Returns true if the text is underlined.

public bool GetUnderline()

Returns

bool

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

color int

Returns

Cell

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

rgbColor float[]

Returns

Cell

SetBarcode(Barcode)

Sets the barcode inside this cell and clears the cell text.

public Cell SetBarcode(Barcode barcode)

Parameters

barcode Barcode

the barcode.

Returns

Cell

this Cell object.

SetBorder(uint, bool)

Sets the cell border object.

public Cell SetBorder(uint border, bool visible)

Parameters

border uint

the border object.

visible bool

true to show the border, false to hide it.

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

color int

Returns

Cell

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

rgbColor float[]

Returns

Cell

SetBorderWidth(float)

Sets the width of the cell borders.

public Cell SetBorderWidth(float borderWidth)

Parameters

borderWidth float

the width of the cell borders.

Returns

Cell

this Cell object.

SetBorders(bool)

Sets all cell borders.

public Cell SetBorders(bool borders)

Parameters

borders bool

true or false.

Returns

Cell

this Cell object.

SetBottomPadding(float)

Sets the bottom padding of this cell.

public Cell SetBottomPadding(float padding)

Parameters

padding float

the bottom padding.

Returns

Cell

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

colspan int

the specified column span value, from 1.

Returns

Cell

SetCompositeTextLine(CompositeTextLine)

Sets the composite text line drawn in this cell.

public Cell SetCompositeTextLine(CompositeTextLine compositeTextLine)

Parameters

compositeTextLine CompositeTextLine

Returns

Cell

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

drawable IDrawable

the 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

fallbackFont Font

the 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

font Font

the font.

Returns

Cell

this Cell object.

SetFontSize(float)

Sets the font size.

public Cell SetFontSize(float fontSize)

Parameters

fontSize float

Returns

Cell

SetImage(Image)

Sets the image inside this cell and clears the cell text.

public Cell SetImage(Image image)

Parameters

image Image

the image.

Returns

Cell

this Cell object.

SetLeftPadding(float)

Sets the left padding of this cell.

public Cell SetLeftPadding(float padding)

Parameters

padding float

the left padding.

Returns

Cell

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

point Point

the point.

alignment Alignment

Alignment.LEFT or Alignment.RIGHT.

Returns

Cell

this Cell object.

SetPadding(float)

Sets the top, bottom, left and right paddings of this cell.

public Cell SetPadding(float padding)

Parameters

padding float

the right padding.

Returns

Cell

SetRightPadding(float)

Sets the right padding of this cell.

public Cell SetRightPadding(float padding)

Parameters

padding float

the right padding.

Returns

Cell

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

rowspan int

the 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

strikeout bool

Returns

Cell

SetText(string)

Sets the cell text.

public Cell SetText(string text)

Parameters

text string

the cell text.

Returns

Cell

this Cell object.

SetTextAlignment(Alignment)

Sets the cell text alignment.

public Cell SetTextAlignment(Alignment alignment)

Parameters

alignment Alignment

the alignment. Supported values: Alignment.LEFT, Alignment.RIGHT, Alignment.CENTER and Alignment.JUSTIFY, which draws the single line of cell text left aligned.

Returns

Cell

SetTextBlock(TextBlock)

Sets the text block drawn in this cell and clears the cell text.

public Cell SetTextBlock(TextBlock textBlock)

Parameters

textBlock TextBlock

Returns

Cell

SetTextColor(int)

Sets the text color as a 0xRRGGBB value. Color.transparent leaves the text color unchanged.

public Cell SetTextColor(int color)

Parameters

color int

Returns

Cell

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

rgbColor float[]

Returns

Cell

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

textColumn TextColumn

Returns

Cell

SetTopPadding(float)

Sets the top padding of this cell.

public Cell SetTopPadding(float padding)

Parameters

padding float

the top padding.

Returns

Cell

SetURIAction(string)

Sets the URI opened when this cell is clicked.

public Cell SetURIAction(string uri)

Parameters

uri string

Returns

Cell

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

underline bool

the underline flag.

Returns

Cell

this Cell object.

SetVerticalAlignment(Alignment)

Sets the cell text vertical alignment.

public Cell SetVerticalAlignment(Alignment alignment)

Parameters

alignment Alignment

the 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

width float

the specified width.

Returns

Cell

this Cell object.