ShapeBaseAlternativeText Property

Defines alternative text to be displayed instead of a graphic.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.5
public string AlternativeText { get; set; }

Property Value

Type: String

The default value is an empty string.

Shows how to insert shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a cube and set its name
Shape shape = builder.InsertShape(ShapeType.Cube, 150, 150);
shape.Name = "MyCube";

// We can also set the alt text like this
// This text will be found in Format AutoShape > Alt Text
shape.AlternativeText = "Alt text for MyCube.";

// Insert a text box
shape = builder.InsertShape(ShapeType.TextBox, 300, 50);
shape.Font.Name = "Times New Roman";

// Move the builder into the text box and write text
builder.Write("Hello world!");

// Move the builder out of the text box back into the main document

// Insert a shape with an image
shape = builder.InsertImage(Image.FromFile(ImageDir + "Logo.jpg"));

// Rotate the image
shape.Rotation = 45.0;

doc.Save(ArtifactsDir + "Shape.Insert.docx");
See Also