Aspose::Words::Border class

Border class

Represents a border of an object. To learn more, visit the Programming with Documents documentation article.

class Border : public Aspose::Words::InternableComplexAttr,
               public Aspose::Words::IComplexAttr

Methods

MethodDescription
ClearFormatting()Resets border properties to default values.
Equals(const System::SharedPtr<Aspose::Words::Border>&)Determines whether the specified border is equal in value to the current border.
Equals(System::SharedPtr<System::Object>) overrideDetermines whether the specified object is equal in value to the current object.
get_Color()Gets or sets the border color.
get_DistanceFromText()Gets or sets distance of the border from text or from the page edge in points.
get_IsVisible()Returns true if the LineStyle is not None.
get_LineStyle()Gets or sets the border style.
get_LineWidth()Gets or sets the border width in points.
get_Shadow()Gets or sets a value indicating whether the border has a shadow.
get_ThemeColor()Gets the theme color in the applied color scheme that is associated with this Border object.
get_TintAndShade()Gets or sets a double value that lightens or darkens a color.
GetHashCode() const overrideServes as a hash function for this type.
GetType() const override
Is(const System::TypeInfo&) const override
set_Color(System::Drawing::Color)Setter for Aspose::Words::Border::get_Color.
set_DistanceFromText(double)Setter for Aspose::Words::Border::get_DistanceFromText.
set_LineStyle(Aspose::Words::LineStyle)Setter for Aspose::Words::Border::get_LineStyle.
set_LineWidth(double)Setter for Aspose::Words::Border::get_LineWidth.
set_Shadow(bool)Setter for Aspose::Words::Border::get_Shadow.
set_ThemeColor(Aspose::Words::Themes::ThemeColor)Sets the theme color in the applied color scheme that is associated with this Border object.
set_TintAndShade(double)Setter for Aspose::Words::Border::get_TintAndShade.
static Type()

Remarks

Borders can be applied to various document elements including paragraph, run of text inside a paragraph or a table cell.

Examples

Shows how to insert a string surrounded by a border into a document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

builder->get_Font()->get_Border()->set_Color(System::Drawing::Color::get_Green());
builder->get_Font()->get_Border()->set_LineWidth(2.5);
builder->get_Font()->get_Border()->set_LineStyle(LineStyle::DashDotStroker);

builder->Write(u"Text surrounded by green border.");

doc->Save(ArtifactsDir + u"Border.FontBorder.docx");

Shows how to insert a paragraph with a top border.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

SharedPtr<Border> topBorder = builder->get_ParagraphFormat()->get_Borders()->idx_get(BorderType::Top);
topBorder->set_Color(System::Drawing::Color::get_Red());
topBorder->set_LineWidth(4.0);
topBorder->set_LineStyle(LineStyle::DashSmallGap);

builder->Writeln(u"Text with a red top border.");

doc->Save(ArtifactsDir + u"Border.ParagraphTopBorder.docx");

See Also