# ColumnWidthsAndDistances Property

> Returns or sets page columns with different widths and distances as an array of 2n-1 Long values in twips; empty when selected sections differ. With example.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Property
- **Path:** TX Text Control ActiveX > API Reference > TXTextControl > ColumnWidthsAndDistances Property
- **532 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/columnwidthsanddistances-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/columnwidthsanddistances-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/columnwidthsanddistances-property/llms-full.txt

---

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](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/sectioncurrent-property/llms-full.txt) 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](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/columns-property/llms-full.txt) and the [ColumnDistance](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/columndistance-property/llms-full.txt) property must be used.

Introduced: 15.0.

### Syntax

```vbscript
TXTextControl.ColumnWidthsAndDistances [= Array]
```

### Data Types

Array of Long.

### Examples

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

```vbscript
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
```

### Limitations

Run time only.

### Remarks

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](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/sectioncurrent-property/llms-full.txt) 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 example above checks the array before using it.

### See Also

- [Programming Category: Sections and Pages](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/sections-pages/llms-full.txt)

---

## Nearby

- **Previous:** [Columns Property](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/columns-property/llms-full.txt)
- **Next:** [CommentChanged Event](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/commentchanged-event/llms-full.txt)
