TableCollection Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.dll
- Inherits
- Table
Base Collection - Table
Collection
- Table
- Implements
- ICollection, IEnumerable
Description
An instance of the TableCollection class contains all tables of a Text Control document or part of the document represented through objects of the type Table. It can be obtained with the TextControl.Tables, HeaderFooter.Tables or TextFrame.Tables property. The TableCollection class is derived from the TableBaseCollection class and implements therefore the IEnumerable and the ICollection interfaces. Additionally to the properties and methods inherited it implements the following:
Syntax
public sealed class TableCollection : TableBaseCollectionPublic NotInheritable Class TableCollection
Inherits TableBaseCollectionExamples
The following example shows how to handle the table collection.
int myTableId = 10;
textControl1.Tables.GridLines = false;
if(textControl1.Tables.CanAdd)
textControl1.Tables.Add(5, 3, myTableId);
TXTextControl.Table myTable = textControl1.Tables.GetItem(myTableId);
textControl1.Tables.Remove(myTableId);Dim MyTableId As Integer = 10
TextControl1.Tables.GridLines = False
If TextControl1.Tables.CanAdd Then
TextControl1.Tables.Add(5, 3, MyTableId)
End If
Dim MyTable As TXTextControl.Table = TextControl1.Tables.GetItem(MyTableId)
TextControl1.Tables.Remove(MyTableId)The following example works with tables in the current document.
TableCollection tableCollection = textControl.Tables;
tableCollection.Add(3, 3, 10);Dim tableCollection As TableCollection = textControl.Tables
tableCollection.Add(3, 3, 10)Members
Properties
| Property | Description |
|---|---|
| CanAdd | Gets a value indicating whether a new table can be inserted at the current input position. This property does not check for protected TextFields and/or protected document sections. To perform this use in addition the TextControl.CanEdit property. |
| Count | Gets the number of tables contained in the collection. (Inherited from TableBaseCollection.) |
| GridLines | Gets or sets a value indicating wether table grid lines are shown or not. |
| IsSynchronized | Returns true if the collection is designed to be thread safe, otherwise, it returns false. (Inherited from TableBaseCollection.) |
| SupportedFormulaFunctions | Gets a list of all formula functions currently supported. These functions are listed in Supported Formula Functions. For more information how to construct a formula with predefined functions see Using Formulas in Table Cells. |
| SupportedNumberFormats | Gets a list of often used number formats for formula results. See Formatting Text by using Number Formats for more information about number format strings. |
| SyncRoot | Gets an object that can be used to synchronize access to the collection. (Inherited from TableBaseCollection.) |
Methods
| Method | Description |
|---|---|
| Add | Adds a new table at the current text input position. |
| Clear | Removes all tables contained in the collection from a Text Control document. (Inherited from TableBaseCollection.) |
| CopyTo | Copies the elements of the collection to an array, starting at a particular index. (Inherited from TableBaseCollection.) |
| GetEnumerator | Returns an enumerator that can be used to iterate through the collection. (Inherited from TableBaseCollection.) |
| GetItem | Gets the table at the current input position. To get a particular table with a certain identifier use the base class's implementation TableBaseCollection.GetItem. |
| GetItem | Gets a particular table from the collection. (Inherited from TableBaseCollection.) |
| Remove | Removes the table at the current text input position. To remove a particular table with a certain identifier use the base class's implementation TableBaseCollection.Remove. |
| Remove | Removes a particular table from the collection. (Inherited from TableBaseCollection.) |