Aspose::Words::Drawing::ShapeBase::set_Name method

ShapeBase::set_Name method

Sets the optional shape name.

void Aspose::Words::Drawing::ShapeBase::set_Name(const System::String & value)

Remarks

Default is empty string.

Cannot be null, but can be an empty string.

Examples

Shows how to use a shape’s alternative text.

auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertShape(ShapeType::Cube, static_cast<double>(150), static_cast<double>(150));
shape->set_Name(u"MyCube");

shape->set_AlternativeText(u"Alt text for MyCube.");

// We can access the alternative text of a shape by right-clicking it, and then via "Format AutoShape" -> "Alt Text".
doc->Save(get_ArtifactsDir() + u"Shape.AltText.docx");

// Save the document to HTML, and then delete the linked image that belongs to our shape.
// The browser that is reading our HTML will display the alt text in place of the missing image.
doc->Save(get_ArtifactsDir() + u"Shape.AltText.html");
System::IO::File::Delete(get_ArtifactsDir() + u"Shape.AltText.001.png");

See Also