Aspose::Words::TextWatermarkOptions class
Contents
[
Hide
]TextWatermarkOptions class
Contains options that can be specified when adding a watermark with text. To learn more, visit the Working with Watermark documentation article.
class TextWatermarkOptions : public System::Object
Methods
Method | Description |
---|---|
get_Color() const | Gets or sets font color. The default value is Silver. |
get_FontFamily() const | Gets or sets font family name. The default value is “Calibri”. |
get_FontSize() const | Gets or sets a font size. The default value is 0 - auto. |
get_IsSemitrasparent() const | Gets or sets a boolean value which is responsible for opacity of the watermark. The default value is true. |
get_Layout() const | Gets or sets layout of the watermark. The default value is Diagonal. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
set_Color(System::Drawing::Color) | Setter for Aspose::Words::TextWatermarkOptions::get_Color. |
set_FontFamily(const System::String&) | Setter for Aspose::Words::TextWatermarkOptions::get_FontFamily. |
set_FontSize(float) | Setter for Aspose::Words::TextWatermarkOptions::get_FontSize. |
set_IsSemitrasparent(bool) | Setter for Aspose::Words::TextWatermarkOptions::get_IsSemitrasparent. |
set_Layout(Aspose::Words::WatermarkLayout) | Setter for Aspose::Words::TextWatermarkOptions::get_Layout. |
TextWatermarkOptions() | |
static Type() |
Examples
Shows how to create a text watermark.
auto doc = System::MakeObject<Aspose::Words::Document>();
// Add a plain text watermark.
doc->get_Watermark()->SetText(u"Aspose Watermark");
// If we wish to edit the text formatting using it as a watermark,
// we can do so by passing a TextWatermarkOptions object when creating the watermark.
auto textWatermarkOptions = System::MakeObject<Aspose::Words::TextWatermarkOptions>();
textWatermarkOptions->set_FontFamily(u"Arial");
textWatermarkOptions->set_FontSize(36.0f);
textWatermarkOptions->set_Color(System::Drawing::Color::get_Black());
textWatermarkOptions->set_Layout(Aspose::Words::WatermarkLayout::Diagonal);
textWatermarkOptions->set_IsSemitrasparent(false);
doc->get_Watermark()->SetText(u"Aspose Watermark", textWatermarkOptions);
doc->Save(get_ArtifactsDir() + u"Document.TextWatermark.docx");
// We can remove a watermark from a document like this.
if (doc->get_Watermark()->get_Type() == Aspose::Words::WatermarkType::Text)
{
doc->get_Watermark()->Remove();
}
See Also
- Namespace Aspose::Words
- Library Aspose.Words for C++