TextColumn Class

Represents a single text column. TextColumn is a member of the TextColumnCollection collection. The TextColumns collection includes all the columns in a section of a document.
Inheritance Hierarchy

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
public class TextColumn

The TextColumn type exposes the following members.

Public propertyCode exampleSpaceAfter
Gets or sets the space between this column and the next column in points. Not required for the last column.
Public propertyCode exampleWidth
Gets or sets the width of the text column in points.
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 methodToString (Inherited from Object.)

TextColumn objects are only used to specify columns with custom width and spacing. If you want the columns in the document to be of equal width, set TextColumns.EvenlySpaced to true.

When a new TextColumn is created it has its width and spacing set to zero.

Creates multiple columns of different widths in a section using DocumentBuilder.
DocumentBuilder builder = new DocumentBuilder();

TextColumnCollection columns = builder.PageSetup.TextColumns;
// Show vertical line between columns
columns.LineBetween = true;
// Indicate we want to create column with different widths
columns.EvenlySpaced = false;
// Create two columns, note they will be created with zero widths, need to set them

// Set the first column to be narrow
TextColumn c1 = columns[0];
c1.Width = 100;
c1.SpaceAfter = 20;

// Set the second column to take the rest of the space available on the page
TextColumn c2 = columns[1];
PageSetup ps = builder.PageSetup;
double contentWidth = ps.PageWidth - ps.LeftMargin - ps.RightMargin;
c2.Width = contentWidth - c1.Width - c1.SpaceAfter;

builder.Writeln("Narrow column 1.");
builder.Writeln("Wide column 2.");

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