Aspose::Words::Drawing::ShapeBase::get_Title method

ShapeBase::get_Title method

Gets or sets the title (caption) of the current shape object.

System::String Aspose::Words::Drawing::ShapeBase::get_Title()

Remarks

Default is empty string.

Cannot be null, but can be an empty string.

Examples

Shows how to set the title of a shape.

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

// Create a shape, give it a title, and then add it to the document.
auto shape = MakeObject<Shape>(doc, ShapeType::Cube);
shape->set_Width(200);
shape->set_Height(200);
shape->set_Title(u"My cube");

builder->InsertNode(shape);

// When we save a document with a shape that has a title,
// Aspose.Words will store that title in the shape's Alt Text.
doc->Save(ArtifactsDir + u"Shape.Title.docx");

doc = MakeObject<Document>(ArtifactsDir + u"Shape.Title.docx");
shape = System::ExplicitCast<Shape>(doc->GetChild(NodeType::Shape, 0, true));

ASSERT_EQ(String::Empty, shape->get_Title());
ASSERT_EQ(u"Title: My cube", shape->get_AlternativeText());

See Also