ShapeBaseAlternativeText Property
Defines alternative text to be displayed instead of a graphic.

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

Property Value

Type: String
Remarks

The default value is an empty string.

Examples
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.MoveTo(shape.LastParagraph);
builder.Write("Hello world!");

// Move the builder out of the text box back into the main document
builder.MoveTo(shape.ParentParagraph);         

// Insert a shape with an image
shape = builder.InsertImage(Image.FromFile(ImageDir + "Aspose.Words.gif"));
Assert.True(shape.CanHaveImage);
Assert.True(shape.HasImage);

// Rotate the image
shape.Rotation = 45.0;

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