Aspose::Words::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.
class TextColumnCollection : public System::Object
Methods
Method | Description |
---|---|
get_Count() | Gets the number of columns in the section of a document. |
get_EvenlySpaced() | True if text columns are of equal width and evenly spaced. |
get_LineBetween() | When true, adds a vertical line between columns. |
get_Spacing() | When columns are evenly spaced, gets or sets the amount of space between each column in points. |
get_Width() | When columns are evenly spaced, gets the width of the columns. |
GetType() const override | |
idx_get(int32_t) | Returns a text column at the specified index. |
Is(const System::TypeInfo&) const override | |
set_EvenlySpaced(bool) | Setter for Aspose::Words::TextColumnCollection::get_EvenlySpaced. |
set_LineBetween(bool) | Setter for Aspose::Words::TextColumnCollection::get_LineBetween. |
set_Spacing(double) | Setter for Aspose::Words::TextColumnCollection::get_Spacing. |
SetCount(int32_t) | Arranges text into the specified number of text columns. |
static Type() |
Remarks
Use SetCount() 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
Shows how to create multiple evenly spaced columns in a section.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<TextColumnCollection> columns = builder->get_PageSetup()->get_TextColumns();
columns->set_Spacing(100);
columns->SetCount(2);
builder->Writeln(u"Column 1.");
builder->InsertBreak(BreakType::ColumnBreak);
builder->Writeln(u"Column 2.");
doc->Save(ArtifactsDir + u"PageSetup.ColumnsSameWidth.docx");
See Also
- Namespace Aspose::Words
- Library Aspose.Words for C++