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
SystemObject
  Aspose.WordsTextColumn

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

The TextColumn type exposes the following members.

Properties
  NameDescription
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.
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Remarks

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.

Examples
Creates multiple columns of different widths in a section using DocumentBuilder.
[C#]

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.
columns.SetCount(2);

// 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.InsertBreak(BreakType.ColumnBreak);
builder.Writeln("Wide column 2.");

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