Aspose::Words::Drawing::ShapeBase::set_IsDecorative method

ShapeBase::set_IsDecorative method

Sets the flag that specifies whether the shape is decorative in the document.

void Aspose::Words::Drawing::ShapeBase::set_IsDecorative(bool value)

Remarks

Note that shape having not empty AlternativeText cannot be decorative.

Examples

Shows how to set that the shape is decorative.

auto doc = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"Decorative shapes.docx"));

auto shape = System::ExplicitCast<Aspose::Words::Drawing::Shape>(doc->GetChildNodes(NodeType::Shape, true)->idx_get(0));
ASSERT_TRUE(shape->get_IsDecorative());

// If "AlternativeText" is not empty, the shape cannot be decorative.
// That's why our value has changed to 'false'.
shape->set_AlternativeText(u"Alternative text.");
ASSERT_FALSE(shape->get_IsDecorative());

auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);

builder->MoveToDocumentEnd();
// Create a new shape as decorative.
shape = builder->InsertShape(ShapeType::Rectangle, static_cast<double>(100), static_cast<double>(100));
shape->set_IsDecorative(true);

doc->Save(get_ArtifactsDir() + u"Shape.IsDecorative.docx");

See Also