TextColumnCollection class

TextColumnCollection class

A collection of TextColumn objects that represent all the columns of text in a section of a document. To learn more, visit the Working with Sections documentation article.

Remarks

Use TextColumnCollection.setCount() to set the number of text columns.

To make all columns equal width and spaced evenly, set TextColumnCollection.evenlySpaced to true and specify the amount of space between the columns in TextColumnCollection.spacing. MS Word will automatically calculate column widths.

If you have TextColumnCollection.evenlySpaced set to false, you need to specify width and spacing for each column individually. Use the indexer to access individual TextColumn objects.

When using custom column widths, make sure the sum of all column widths and spacings between them equals page width minus left and right page margins.

Properties

NameDescription
countGets the number of columns in the section of a document.
evenlySpacedTrue if text columns are of equal width and evenly spaced.
lineBetweenWhen true, adds a vertical line between columns.
spacingWhen columns are evenly spaced, gets or sets the amount of space between each column in points.
this[]
widthWhen columns are evenly spaced, gets the width of the columns.

Methods

NameDescription
setCount(newCount)Arranges text into the specified number of text columns.

Examples

Shows how to create multiple evenly spaced columns in a section.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

let columns = builder.pageSetup.textColumns;
columns.spacing = 100;
columns.setCount(2);

builder.writeln("Column 1.");
builder.insertBreak(aw.BreakType.ColumnBreak);
builder.writeln("Column 2.");

doc.save(base.artifactsDir + "PageSetup.ColumnsSameWidth.docx");

See Also