TextColumnCollection Class
A collection of TextColumn objects that represent all the columns of text in a section of a document.
Inheritance Hierarchy
SystemObject
  Aspose.WordsTextColumnCollection

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class TextColumnCollection

The TextColumnCollection type exposes the following members.

Properties
  NameDescription
Public propertyCount
Gets the number of columns in the section of a document.
Public propertyCode exampleEvenlySpaced
True if text columns are of equal width and evenly spaced.
Public propertyCode exampleItem
Returns a text column at the specified index.
Public propertyCode exampleLineBetween
When true, adds a vertical line between columns.
Public propertyCode exampleSpacing
When columns are evenly spaced, gets or sets the amount of space between each column in points.
Public propertyWidth
When columns are evenly spaced, gets the width of the columns.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleSetCount
Arranges text into the specified number of text columns.
Public methodToString (Inherited from Object.)
Remarks

Use SetCount(Int32) to set the number of text columns.

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

If you have 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.

Examples
Creates multiple evenly spaced columns in a section using DocumentBuilder.
DocumentBuilder builder = new DocumentBuilder();

TextColumnCollection columns = builder.PageSetup.TextColumns;
// Make spacing between columns wider.
columns.Spacing = 100;
// This creates two columns of equal width.
columns.SetCount(2);

builder.Writeln("Text in column 1.");
builder.InsertBreak(BreakType.ColumnBreak);
builder.Writeln("Text in column 2.");

builder.Document.Save(ArtifactsDir + "PageSetup.ColumnsSameWidth.doc");
See Also