search/mag_sel search/close
Aspose::Words::TextColumn Class Reference

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.

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.

See also
Aspose::Words::TextColumnCollection
Aspose::Words::PageSetup
Aspose::Words::Section
Examples

Shows how to create unevenly spaced columns.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<PageSetup> pageSetup = builder->get_PageSetup();
SharedPtr<TextColumnCollection> columns = pageSetup->get_TextColumns();
columns->set_EvenlySpaced(false);
columns->SetCount(2);
// Determine the amount of room that we have available for arranging columns.
double contentWidth = pageSetup->get_PageWidth() - pageSetup->get_LeftMargin() - pageSetup->get_RightMargin();
ASSERT_NEAR(470.30, contentWidth, 0.01);
// Set the first column to be narrow.
SharedPtr<TextColumn> column = columns->idx_get(0);
column->set_Width(100);
column->set_SpaceAfter(20);
// Set the second column to take the rest of the space available within the margins of the page.
column = columns->idx_get(1);
column->set_Width(contentWidth - column->get_Width() - column->get_SpaceAfter());
builder->Writeln(u"Narrow column 1.");
builder->InsertBreak(BreakType::ColumnBreak);
builder->Writeln(u"Wide column 2.");
doc->Save(ArtifactsDir + u"PageSetup.CustomColumnWidth.docx");

#include <Aspose.Words.Cpp/TextColumn.h>

+ Inheritance diagram for Aspose::Words::TextColumn:

Public Member Functions

double get_SpaceAfter ()
 Gets or sets the space between this column and the next column in points. Not required for the last column. More...
 
double get_Width ()
 Gets or sets the width of the text column in points. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_SpaceAfter (double value)
 Setter for get_SpaceAfter. More...
 
void set_Width (double value)
 Setter for get_Width. More...
 

Static Public Member Functions

static const TypeInfoType ()
 

Member Function Documentation

◆ get_SpaceAfter()

double Aspose::Words::TextColumn::get_SpaceAfter ( )

Gets or sets the space between this column and the next column in points. Not required for the last column.

Examples

Shows how to create unevenly spaced columns.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<PageSetup> pageSetup = builder->get_PageSetup();
SharedPtr<TextColumnCollection> columns = pageSetup->get_TextColumns();
columns->set_EvenlySpaced(false);
columns->SetCount(2);
// Determine the amount of room that we have available for arranging columns.
double contentWidth = pageSetup->get_PageWidth() - pageSetup->get_LeftMargin() - pageSetup->get_RightMargin();
ASSERT_NEAR(470.30, contentWidth, 0.01);
// Set the first column to be narrow.
SharedPtr<TextColumn> column = columns->idx_get(0);
column->set_Width(100);
column->set_SpaceAfter(20);
// Set the second column to take the rest of the space available within the margins of the page.
column = columns->idx_get(1);
column->set_Width(contentWidth - column->get_Width() - column->get_SpaceAfter());
builder->Writeln(u"Narrow column 1.");
builder->InsertBreak(BreakType::ColumnBreak);
builder->Writeln(u"Wide column 2.");
doc->Save(ArtifactsDir + u"PageSetup.CustomColumnWidth.docx");

◆ get_Width()

double Aspose::Words::TextColumn::get_Width ( )

Gets or sets the width of the text column in points.

Examples

Shows how to create unevenly spaced columns.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<PageSetup> pageSetup = builder->get_PageSetup();
SharedPtr<TextColumnCollection> columns = pageSetup->get_TextColumns();
columns->set_EvenlySpaced(false);
columns->SetCount(2);
// Determine the amount of room that we have available for arranging columns.
double contentWidth = pageSetup->get_PageWidth() - pageSetup->get_LeftMargin() - pageSetup->get_RightMargin();
ASSERT_NEAR(470.30, contentWidth, 0.01);
// Set the first column to be narrow.
SharedPtr<TextColumn> column = columns->idx_get(0);
column->set_Width(100);
column->set_SpaceAfter(20);
// Set the second column to take the rest of the space available within the margins of the page.
column = columns->idx_get(1);
column->set_Width(contentWidth - column->get_Width() - column->get_SpaceAfter());
builder->Writeln(u"Narrow column 1.");
builder->InsertBreak(BreakType::ColumnBreak);
builder->Writeln(u"Wide column 2.");
doc->Save(ArtifactsDir + u"PageSetup.CustomColumnWidth.docx");

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::TextColumn::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ Is()

virtual bool Aspose::Words::TextColumn::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ set_SpaceAfter()

void Aspose::Words::TextColumn::set_SpaceAfter ( double  value)

◆ set_Width()

void Aspose::Words::TextColumn::set_Width ( double  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::TextColumn::Type ( )
static