Table Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. Core. SDK
- Assembly
TXTextControl.Core. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. Core. SDK TXTextControl.from the setup.dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
An instance of the Table class represents a table in a Text Control document. It can be obtained from the document's table collection.
Syntax
public class TablePublic Class TableExamples
The following example shows how to split a table.
textControl1.ResetContents();
int myTableId = 10;
textControl1.Tables.Add(10, 3, myTableId);
TXTextControl.Table myTable = textControl1.Tables.GetItem(myTableId);
textControl1.InputPosition =
new TXTextControl.InputPosition(myTable.Cells.GetItem(3, 1).Start);
if (myTable.CanSplit)
myTable.Split(TXTextControl.TableAddPosition.After);
// Correct the table IDs after splitting the original table.
foreach (TXTextControl.Table myCurrentTable in textControl1.Tables)
myCurrentTable.ID = myTableId++;TextControl1.ResetContents()
Dim MyTableId As Integer = 10
TextControl1.Tables.Add(10, 3, MyTableId)
Dim MyTable As TXTextControl.Table = TextControl1.Tables.GetItem(MyTableId)
TextControl1.InputPosition = _
New TXTextControl.InputPosition(MyTable.Cells.GetItem(3, 1).Start)
If MyTable.CanSplit Then
MyTable.Split(TXTextControl.TableAddPosition.After)
End If
' Correct the table IDs after splitting the original table.
For Each MyCurrentTable As TXTextControl.Table In TextControl1.Tables
MyCurrentTable.ID = MyTableId
MyTableId = MyTableId + 1
NextThe following example accesses a Table object and reads its can merge cells value.
var value = table.CanMergeCells;
Console.WriteLine(value);Dim value = table.CanMergeCells
Console.WriteLine(value)Members
Properties
| Property | Description |
|---|---|
| CanMergeCells | Checks whether table cells can be merged. Table cells can only be merged, if more than one cell in this table is selected. |
| CanSplit | Checks whether this table can be split. A table can only be split if it contains the current input position and no further text is selected. |
| CanSplitCells | Returns true, if the currently selected table cells are merged. |
| Cells | Gets a collection of all table cells the table consists of. The property's value is an object of the type TableCellCollection. |
| Columns | Gets a collection of all columns the table consists of. The property's value is an object of the type TableColumnCollection. |
| DescriptiveText | Gets or sets a descriptive text for a table. An empty string indicates that the table has no such text. An empty string can also be used to delete a previously set text. |
| ID | Gets or sets the table's identifier. It must be between 10 and short.MaxValue. |
| NestedLevel | Gets the nested level for the specified table. Top level tables have a level of 1. |
| NestedTables | Gets a collection of all tables nested in this table. The property's value is an object of the type TableBaseCollection. |
| OuterMostTable | Gets a table's outermost table. This is a top-level table with a nested level of 1. The property's value is an object of the type Table or null if this table is already a top-level table. |
| OuterTable | Gets a table's outer table. The property's value is an object of the type Table or null if this table is a top-level table. |
| Rows | Gets a collection of all rows the table consists of. The property's value is an object of the type TableRowCollection. |
Methods
| Method | Description |
|---|---|
| MergeCells | Merges all selected table cells in this table. The Table.CanMergeCells property can be used to determine, if table cells can be merged or not. |
| Select | Selects the table or a part of the table. |
| Split | Splits a table below or above the current input position. If the table does not contain the current input position it cannot be split. The Table.CanSplit property can be used to determine if a table can be split or not. If a table is split above the first row a new line is inserted above the table and if a table is split below the last row a new line is inserted below the table. This is useful to insert text above or below a nested table that immediately starts and/or ends at the beginning or the end of the cell in which it is nested. |
| SplitCells | Splits all selected table cells in this table. Only previously merged cells can be split. The Table.CanSplitCells property can be used to determine, if table cells can be split or not. |