TableColumnCollection Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
- Inherits
- Table
Part Collection - Table
Column Collection
- Table
- Implements
- ICollection, IEnumerable
Description
An instance of the TableColumnCollection class contains all columns of a table in a Text Control document represented through objects of the type TableColumn. It can be obtained with the Table.Columns property. The TableColumnCollection class implements the IEnumerable and the ICollection interfaces.
Syntax
public sealed class TableColumnCollection : TablePartCollectionPublic NotInheritable Class TableColumnCollection
Inherits TablePartCollectionExamples
The following example shows how to use the table column collection.
int myLastCol = myTable.Columns.Count;
TXTextControl.TableColumn myCol = myTable.Columns.GetItem(myLastCol);
TXTextControl.TableCell myCell = myTable.Cells.GetItem(1, myLastCol);
int myNewWidth = (int)(myCol.Width / 2);
textControl1.InputPosition = new TXTextControl.InputPosition(myCell.Start - 1);
if (myTable.Columns.CanAdd)
{
myCol.Width = myNewWidth;
myTable.Columns.Add(TXTextControl.TableAddPosition.After);
}Dim MyLastCol As Integer = MyTable.Columns.Count
Dim MyCol As TXTextControl.TableColumn = MyTable.Columns.GetItem(MyLastCol)
Dim MyCell As TXTextControl.TableCell = MyTable.Cells.GetItem(1, MyLastCol)
Dim MyNewWidth As Integer = CInt(MyCol.Width / 2)
TextControl1.InputPosition = New TXTextControl.InputPosition(MyCell.Start - 1)
If MyTable.Columns.CanAdd Then
MyCol.Width = MyNewWidth
MyTable.Columns.Add(TXTextControl.TableAddPosition.After)
End IfThe following example creates a small report table and works with its structure.
textControl.Tables.Add(3, 3, 10);
Table table = textControl.Tables.GetItem(10);
TableColumnCollection tableColumnCollection = table.Columns;textControl.Tables.Add(3, 3, 10)
Dim table As Table = textControl.Tables.GetItem(10)
Dim tableColumnCollection As TableColumnCollection = table.ColumnsMembers
Properties
| Property | Description |
|---|---|
| CanAdd | Gets a value indicating whether a new column 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. |
| CanRemove | Gets a value indicating whether table columns can be removed. Columns can be removed if either the current text input position is in a table or if a part of a table is selected. |
| Count | Gets the number of elements contained in the collection. (Inherited from TablePartCollection.) |
| IsSynchronized | Returns true if the collection is designed to be thread safe, otherwise, it returns false. (Inherited from TablePartCollection.) |
| Item | Not described in the reference. public TableColumn this[int column] { get; } |
| SyncRoot | Gets an object that can be used to synchronize access to the collection. (Inherited from TablePartCollection.) |
Methods
| Method | Description |
|---|---|
| Add | Adds a new table column at the current text input position. |
| CopyTo | Copies the elements of the collection to an array, starting at a particular index. |
| GetEnumerator | Returns an enumerator that can be used to iterate through the collection. (Inherited from TablePartCollection.) |
| GetItem | Gets a particular table column from the collection. |
| Remove | Removes the table column at the current text input position or all selected table columns when a text selection exists. |