title property

ShapeBase.title property

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

@property
def title(self) -> str:
    ...

@title.setter
def title(self, value: str):
    ...

Remarks

Default is empty string.

Cannot be None, but can be an empty string.

Examples

Shows how to set the title of a shape.

doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
# Create a shape, give it a title, and then add it to the document.
shape = aw.drawing.Shape(doc, aw.drawing.ShapeType.CUBE)
shape.width = 200
shape.height = 200
shape.title = 'My cube'
builder.insert_node(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(file_name=ARTIFACTS_DIR + 'Shape.Title.docx')
doc = aw.Document(file_name=ARTIFACTS_DIR + 'Shape.Title.docx')
shape = doc.get_child(aw.NodeType.SHAPE, 0, True).as_shape()
self.assertEqual('', shape.title)
self.assertEqual('Title: My cube', shape.alternative_text)

See Also