Aspose::Words::BorderCollection class
Contents
[
Hide
]BorderCollection class
A collection of Border objects. To learn more, visit the Programming with Documents documentation article.
class BorderCollection : public System::Collections::Generic::IEnumerable<System::SharedPtr<Aspose::Words::Border>>
Methods
| Method | Description |
|---|---|
| ClearFormatting() | Removes all borders of an object. |
| Equals(const System::SharedPtr<Aspose::Words::BorderCollection> &) | Compares collections of borders. |
| GetEnumerator() override | Returns an enumerator object that can be used to iterate over all borders in the collection. |
| get_Bottom() | Gets the bottom border. |
| get_Color() | Gets or sets the border color. |
| get_Count() | Gets the number of borders in the collection. |
| get_DistanceFromText() | Gets or sets distance of the border from text in points. |
| get_Horizontal() | Gets the horizontal border that is used between cells or conforming paragraphs. |
| get_Left() | Gets the left border. |
| get_LineStyle() | Gets or sets the border style. |
| get_LineWidth() | Gets or sets the border width in points. |
| get_Right() | Gets the right border. |
| get_Shadow() | Gets or sets a value indicating whether the border has a shadow. |
| get_Top() | Gets the top border. |
| get_Vertical() | Gets the vertical border that is used between cells. |
| idx_get(Aspose::Words::BorderType) | Retrieves a Border object by border type. |
| idx_get(int32_t) | Retrieves a Border object by index. |
| set_Color(System::Drawing::Color) | Sets the border color. |
| set_DistanceFromText(double) | Sets distance of the border from text in points. |
| set_LineStyle(Aspose::Words::LineStyle) | Sets the border style. |
| set_LineWidth(double) | Sets the border width in points. |
| set_Shadow(bool) | Sets a value indicating whether the border has a shadow. |
Remarks
Different document elements have different borders. For example, ParagraphFormat has Bottom, Left, Right and Top borders. You can specify different formatting for each border independently or enumerate through all borders and apply same formatting.
Examples
Shows how to insert a paragraph with a top border.
auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
System::SharedPtr<Aspose::Words::Border> topBorder = builder->get_ParagraphFormat()->get_Borders()->get_Top();
topBorder->set_LineWidth(4.0);
topBorder->set_LineStyle(LineStyle::DashSmallGap);
// Set ThemeColor only when LineWidth or LineStyle setted.
topBorder->set_ThemeColor(ThemeColor::Accent1);
topBorder->set_TintAndShade(0.25);
builder->Writeln(u"Text with a top border.");
doc->Save(get_ArtifactsDir() + u"Border.ParagraphTopBorder.docx");
See Also
- Namespace Aspose::Words
- Library Aspose.Words for C++