Table Class
Represents a set of paragraphs (and other Block-level content) arranged in rows and columns.
public sealed class Table : Block, IContentElement
Public NotInheritable Class Table
Inherits Block
Implements IContentElement
- Inheritance:
- System.ObjectTable
Implements
Remarks
Table is a Block derived content element consisting of TableRows.
Table can be formatted using the TableFormat property.
Default width for table columns can be specified with Columns property.
For more information, see table examples.
Constructors
Table(DocumentModel)
Initializes a new instance of the Table class.
Parameters
document
- DocumentModel
The owner document.
Table(DocumentModel, TableRow[])
Initializes a new instance of the Table class with specified rows.
public Table(DocumentModel document, params TableRow[] rows)
Public Sub New(document As DocumentModel, ParamArray rows As TableRow())
Parameters
document
- DocumentModel
The owner document.
rows
- TableRow[]
The table rows.
Table(DocumentModel, IEnumerable<TableRow>)
Initializes a new instance of the Table class with specified rows.
public Table(DocumentModel document, IEnumerable<TableRow> rows)
Public Sub New(document As DocumentModel, rows As IEnumerable(Of TableRow))
Parameters
document
- DocumentModel
The owner document.
rows
- System.Collections.Generic.IEnumerable<TableRow>
The table rows.
Table(DocumentModel, Int32, Int32)
Initializes a new instance of the Table class with a specified row and column count.
public Table(DocumentModel document, int rowCount, int columnCount)
Public Sub New(document As DocumentModel, rowCount As Integer, columnCount As Integer)
Parameters
document
- DocumentModel
The owner document.
rowCount
- System.Int32
The row count.
columnCount
- System.Int32
The column count.
Table(DocumentModel, Int32, Int32, CreateTableCell)
Initializes a new instance of the Table class with a specified number of row and column count and a method used to create TableCells.
public Table(DocumentModel document, int rowCount, int columnCount, CreateTableCell tableCellCreator)
Public Sub New(document As DocumentModel, rowCount As Integer, columnCount As Integer, tableCellCreator As CreateTableCell)
Parameters
document
- DocumentModel
The owner document.
rowCount
- System.Int32
The row count.
columnCount
- System.Int32
The column count.
tableCellCreator
- CreateTableCell
The table cell creator.
Properties
Columns
Gets the table columns.
public TableColumnCollection Columns { get; }
Public ReadOnly Property Columns As TableColumnCollection
Property Value
The table columns.
Remarks
This collection does not reflect the structure of a Table (how many TableCells are in each TableRow), it is used just to specify a width for all TableCells that are contained in the specific table column through PreferredWidth.
See Also
ColumnsRevision
Gets or sets the revision of the table grid. This property contains the columns and their widths before this revision
public TableColumnCollectionRevision ColumnsRevision { get; set; }
Public Property ColumnsRevision As TableColumnCollectionRevision
Property Value
The revision of the table grid.
Document
Gets the owner document.
public override DocumentModel Document { get; }
Public Overrides ReadOnly Property Document As DocumentModel
Property Value
The owner document.
Overrides
ElementType
Gets the ElementType of this Element instance.
public override ElementType ElementType { get; }
Public Overrides ReadOnly Property ElementType As ElementType
Property Value
The ElementType of this Element instance.
Overrides
Metadata
Gets the metadata (non-visual properties) of this Table instance.
Property Value
The metadata (non-visual properties) of this Table instance.
Rows
Gets the table rows.
Property Value
The table rows.
Remarks
TableFormat
Gets or sets the table format.
Property Value
The table format.
TableFormatRevision
Gets or sets the revision of the format of this table. This property contains the format which was applied to this table before the revision.
public TableFormatRevision TableFormatRevision { get; set; }
Public Property TableFormatRevision As TableFormatRevision
Property Value
The revision of the format of this table.
Remarks
The revision is internally stored as a member of TableFormat. Using set property on TableFormat overrides this revision.
Methods
Clone(Boolean)
Clones this Table instance.
public Table Clone(bool cloneDescendants)
Public Function Clone(cloneDescendants As Boolean) As Table
Parameters
cloneDescendants
- System.Boolean
If set to true clone all descendants recursively; otherwise clone only current Table.
Returns
Remarks
Document content element instance can exist only in a one place in the document.
If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.
If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.
For more information, see cloning example.
Inherited Properties
Content | Gets the content of the current Element. (Inherited from Element) |
Parent | Gets the parent of this Element instance. (Inherited from Element) |
ParentCollection | Gets the BlockCollection that contains this Block instance. (Inherited from Block) |
Inherited Methods
GetChildElements(System.Boolean) | Gets the child elements. (Inherited from Element) |
GetChildElements(System.Boolean, ElementType[]) | Gets the child elements filtered by ElementType. (Inherited from Element) |
GetParentElements() | Gets the parent elements. (Inherited from Element) |
GetParentElements(ElementType[]) | Gets the parent elements. (Inherited from Element) |