[]
        
(Showing Draft Content)

GrapeCity.Documents.Drawing.TableRenderer

Class TableRenderer

Namespace
GrapeCity.Documents.Drawing
Assembly
GcDocs.Imaging.dll

A helper class for drawing tables on a GcGraphics.

This class is based on the layout engine (see LayoutHost and related classes), and supports drawing simple or complex tables with merged, rotated, auto-sized, multilayer cells with customizable styles. Table cells can contain simple text, multi-formatted TextLayout, or owner-drawn content.

public class TableRenderer
Inheritance
object
TableRenderer
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

TableRenderer(GcGraphics, LayoutRect, FixedTableSides, int, int, Color, float, float?, float?, float?, float, float, float, float)

Initializes a new instance of the TableRenderer class.

public TableRenderer(GcGraphics graphics, LayoutRect tableRect, FixedTableSides fixedSides, int rowCount, int columnCount, Color gridLineColor, float gridLineWidth, float? rowMinHeight = null, float? columnMinWidth = null, float? paddingAll = null, float paddingLeft = 0, float paddingTop = 0, float paddingRight = 0, float paddingBottom = 0)

Parameters

graphics GcGraphics

A GcGraphics used for creating TextLayout objects.

tableRect LayoutRect

A LayoutRect of the table.

fixedSides FixedTableSides

Specifies which sides of a table are fixed, i.e. don't move depending on the table content.

rowCount int

The overall number of rows in the table.

columnCount int

The overall number of columns in the table.

gridLineColor System.Drawing.Color

The color of grid lines.

gridLineWidth float

The default grid line width, in graphic units.

rowMinHeight float?

The optional minimal height for each row, in graphic units.

columnMinWidth float?

The optional minimal width for each column, in graphic units.

paddingAll float?

All sides padding relative to the table rectangle, in graphic units.

paddingLeft float

Left side padding relative to the table rectangle, in graphic units.

paddingTop float

Top side padding relative to the table rectangle, in graphic units.

paddingRight float

Right side padding relative to the table rectangle, in graphic units.

paddingBottom float

Bottom side padding relative to the table rectangle, in graphic units.

See Also

Properties

Cells

Gets a read-only list of all table cells.

public IReadOnlyList<TableCell> Cells { get; }

Property Value

System.Collections.Generic.IReadOnlyList<T><TableCell>
See Also

ColumnCount

Gets the number of columns in the table.

public int ColumnCount { get; }

Property Value

int
See Also

ColumnRects

Gets the array of column LayoutRects.

public LayoutRect[] ColumnRects { get; }

Property Value

LayoutRect[]
See Also

DefaultCellStyle

Gets or sets the default CellStyle.

public CellStyle DefaultCellStyle { get; set; }

Property Value

CellStyle
See Also

Graphics

Gets a GcGraphics used for creating TextLayout objects.

public GcGraphics Graphics { get; }

Property Value

GcGraphics
See Also

GridLineColor

Gets or sets the color of grid lines.

public Color GridLineColor { get; set; }

Property Value

System.Drawing.Color
See Also

HorizontalGridLineRects

Gets the array of LayoutRects for horizontal grid lines.

public LayoutRect[] HorizontalGridLineRects { get; }

Property Value

LayoutRect[]
See Also

this[int, int]

Gets a regular table cell at the specified rowIndex and columnIndex.

Background and foreground cells can be obtained with the Cells property.

public TableCell this[int rowIndex, int columnIndex] { get; }

Parameters

rowIndex int
columnIndex int

Property Value

TableCell
See Also

RowCount

Gets the number of rows in the table.

public int RowCount { get; }

Property Value

int
See Also

RowRects

Gets the array of row LayoutRects.

public LayoutRect[] RowRects { get; }

Property Value

LayoutRect[]
See Also

TableFrameStyle

Gets or sets the style of the outer table frame.

public FrameStyle TableFrameStyle { get; set; }

Property Value

FrameStyle
See Also

TableRect

Gets a LayoutRect for the table.

public LayoutRect TableRect { get; }

Property Value

LayoutRect
See Also

VerticalGridLineRects

Gets the array of LayoutRects for vertical grid lines.

public LayoutRect[] VerticalGridLineRects { get; }

Property Value

LayoutRect[]
See Also

Methods

AddCell(CellStyle, int, int, int, int, object)

Creates a table cell with given style and a new TextLayout inside.

public TableCell AddCell(CellStyle cellStyle, int rowIndex, int columnIndex, int rowSpan, int columnSpan, object data)

Parameters

cellStyle CellStyle

The style of the cell, or null to use the default style.

rowIndex int

Index of top row in the cell.

columnIndex int

Index of left column in the cell.

rowSpan int

The number of rows covered by a cell.

columnSpan int

The number of columns covered by a cell.

data object

A data object or string to be displayed in the cell.

Returns

TableCell

A TableCell object.

See Also

AddCell(CellStyle, int, int, int, int)

Creates an empty table cell with given style at the specified position.

public TableCell AddCell(CellStyle cellStyle, int rowIndex, int columnIndex, int rowSpan = 1, int columnSpan = 1)

Parameters

cellStyle CellStyle

The style of the cell, or null to use the default style.

rowIndex int

Index of top row in the cell.

columnIndex int

Index of left column in the cell.

rowSpan int

The number of rows covered by a cell.

columnSpan int

The number of columns covered by a cell.

Returns

TableCell

A TableCell object.

See Also

AddCell(CellStyle, int, int, object)

Creates a table cell with given style and a new TextLayout inside.

public TableCell AddCell(CellStyle cellStyle, int rowIndex, int columnIndex, object data)

Parameters

cellStyle CellStyle

The style of the cell, or null to use the default style.

rowIndex int

Index of top row in the cell.

columnIndex int

Index of left column in the cell.

data object

A data object or string to be displayed in the cell.

Returns

TableCell

A TableCell object.

See Also

AddCell(int, int, int, int, object)

Creates a table cell with default style and a new TextLayout inside.

public TableCell AddCell(int rowIndex, int columnIndex, int rowSpan, int columnSpan, object data)

Parameters

rowIndex int

Index of top row in the cell.

columnIndex int

Index of left column in the cell.

rowSpan int

The number of rows covered by a cell.

columnSpan int

The number of columns covered by a cell.

data object

A data object or string to be displayed in the cell.

Returns

TableCell

A TableCell object.

See Also

AddCell(int, int, int, int)

Creates an empty table cell with default style at the specified position.

public TableCell AddCell(int rowIndex, int columnIndex, int rowSpan = 1, int columnSpan = 1)

Parameters

rowIndex int

Index of top row in the cell.

columnIndex int

Index of left column in the cell.

rowSpan int

The number of rows covered by a cell.

columnSpan int

The number of columns covered by a cell.

Returns

TableCell

A TableCell object.

See Also

AddCell(int, int, object)

Creates a table cell with default style and a new TextLayout inside.

public TableCell AddCell(int rowIndex, int columnIndex, object data)

Parameters

rowIndex int

Index of top row in the cell.

columnIndex int

Index of left column in the cell.

data object

A data object or string to be displayed in the cell.

Returns

TableCell

A TableCell object.

See Also

AddMissingCells(CellStyle, int, int, int, int, object)

Adds the regular cells to fill out the gaps in the specified rectangular range of table cells.

public void AddMissingCells(CellStyle cellStyle, int rowIndex, int columnIndex, int rowCount, int columnCount, object data)

Parameters

cellStyle CellStyle

The style of the new cells, or null to apply the default cell style.

rowIndex int

Index of top row in the cell range.

columnIndex int

Index of left column in the cell range.

rowCount int

Number of rows in the cell range.

columnCount int

Number of columns in the cell range.

data object

A data object or string to be displayed in the cells.

See Also

AddMissingCells(CellStyle, int, int, int, int)

Adds empty regular cells to fill out the gaps in the specified rectangular range of table cells.

public void AddMissingCells(CellStyle cellStyle, int rowIndex, int columnIndex, int rowCount, int columnCount)

Parameters

cellStyle CellStyle

The style of the new cells, or null to apply the default cell style.

rowIndex int

Index of top row in the cell range.

columnIndex int

Index of left column in the cell range.

rowCount int

Number of rows in the cell range.

columnCount int

Number of columns in the cell range.

See Also

AddMissingCells(CellStyle, object)

Adds the regular cells to fill out the gaps in the table.

public void AddMissingCells(CellStyle cellStyle, object data)

Parameters

cellStyle CellStyle

The style of the new cells, or null to apply the default cell style.

data object

A data object or string to be displayed in the cells.

See Also

AddMissingCells(CellStyle)

Adds empty regular cells to fill out the gaps in the table.

public void AddMissingCells(CellStyle cellStyle = null)

Parameters

cellStyle CellStyle

The style of the new cells, or null to apply the default cell style.

See Also

AddMissingCells(int, int, int, int, object)

Adds the regular cells to fill out the gaps in the specified rectangular range of table cells.

public void AddMissingCells(int rowIndex, int columnIndex, int rowCount, int columnCount, object data)

Parameters

rowIndex int

Index of top row in the cell range.

columnIndex int

Index of left column in the cell range.

rowCount int

Number of rows in the cell range.

columnCount int

Number of columns in the cell range.

data object

A data object or string to be displayed in the cells.

See Also

AddMissingCells(int, int, int, int)

Adds empty regular cells to fill out the gaps in the specified rectangular range of table cells.

public void AddMissingCells(int rowIndex, int columnIndex, int rowCount, int columnCount)

Parameters

rowIndex int

Index of top row in the cell range.

columnIndex int

Index of left column in the cell range.

rowCount int

Number of rows in the cell range.

columnCount int

Number of columns in the cell range.

See Also

ApplyCellConstraints()

Performs layout of the table cells.

Execute this method after adding all cells to the table.

public void ApplyCellConstraints()
See Also

Render(GcGraphics)

Draws the table to a GcGraphics.

public void Render(GcGraphics graphics = null)

Parameters

graphics GcGraphics

The target GcGraphics. If null, the value is taken from the Graphics property. The resolution of graphics must be the same as of Graphics.

See Also

SetHorizontalGridLineWidth(int, float)

Sets the width of horizontal grid line with a specified index.

public void SetHorizontalGridLineWidth(int horizontalGridLineIndex, float gridLineWidth)

Parameters

horizontalGridLineIndex int

Index of the horizontal grid line [0..RowCount].

gridLineWidth float

The height of the horizontal grid line, in graphic units.

See Also

SetVerticalGridLineWidth(int, float)

Sets the width of vertical grid line with a specified index.

public void SetVerticalGridLineWidth(int verticalGridLineIndex, float gridLineWidth)

Parameters

verticalGridLineIndex int

Index of the vertical grid line [0..ColumnCount].

gridLineWidth float

The width of the vertical grid line, in graphic units.

See Also

See Also