TXTextControl.ColumnWidthsAndDistances Property

Returns or sets the number of columns on a page including its widths and distances for the whole document or for a document's section. The SectionCurrent property determines the part of the document. The property returns or sets an array of Long values containing the widths of the columns and the widths of the distances between the columns. If n is the number of columns the size of the array must be 2n-1. The first n values are the widths of the columns and the remaining n-1 values are the distances between the columns. This property sets columns with different widths and distances. To set columns with equal widths and distances, which are automatically adapted to the page width, the Columns and the ColumnDistance property must be used.

Introduced: 15.0.


TXTextControl.ColumnWidthsAndDistances [= Array]


The sum of all widths must be equal or less than the text area of the page, which is the page width without the page margins. All values must be in twips.

The property returns an empty array, if more than one section is specified through the SectionCurrent property and these sections have a different number of columns or their widths and distances. If the array is empty, the LBound property returns 0 and the UBound property returns -1. The following code example checks the array before using it.

Data Types

Array of Long.


Run time only.


The following code demonstrates how the array can be checked if multiple sections have been selected:

Widths = TXTextControl1.ColumnWidthsAndDistances
lb = LBound(Widths, 1)
ub = UBound(Widths, 1)
If ub - lb + 1 > 0 Then
    For i = lb To ub
        Debug.Print Widths(i)
    Next i
End If

See Also