# Alternative Text

## Content

To assist visually impaired individuals in understanding the content of shapes, users can add alternative text (alt text) to shapes. When content is accessed using a screen reader, this associated alternative text is identified and read aloud, enabling users to better understand the shape’s purpose or meaning.
DsExcel.NET provides the [Title](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Title.html), [AlternativeText](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.AlternativeText.html), and [Decorative](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Decorative.html#GrapeCity_Documents_Excel_Drawing_IShape_Decorative_) properties of the [IShape](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.html) interface, which are used to set the title and content of a shape’s alternative text, or to indicate whether the shape is decorative.

| **Property** | **Description** |
| -------- | ----------- |
| [Title](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Title.html) | Sets the title for the alternative text of a shape. |
| [AlternativeText](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.AlternativeText.html) | Sets the main content for the shape's alternative text. |
| [Decorative](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Decorative.html#GrapeCity_Documents_Excel_Drawing_IShape_Decorative_) | Indicates whether the shape is decorative. When set to **true**, the shape is marked as decorative and will generally be ignored by screen readers.<ul><li>Setting the [AlternativeText](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.AlternativeText.html) property to a non-empty string automatically sets [Decorative](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Decorative.html#GrapeCity_Documents_Excel_Drawing_IShape_Decorative_) to **false**.</li><li>Setting the [Decorative](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Decorative.html#GrapeCity_Documents_Excel_Drawing_IShape_Decorative_) property to **true** clears the alternative text.</li></ul>Default value: **false**. |

>type=info
> * Shapes, as well as pictures, charts, slicers, group shapes, linked pictures, and controls support alternative text.
> * SpreadJS does not support the [Decorative](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Decorative.html#GrapeCity_Documents_Excel_Drawing_IShape_Decorative_) property. If a file has the [Decorative](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.Drawing.IShape.Decorative.html#GrapeCity_Documents_Excel_Drawing_IShape_Decorative_) property set and is exported to SJS or SSJSON format, the **Decorative** setting will not be retained.

## Add Alternative Text

Refer to the following sample code to add alternative text to a shape.

```csharp
// Create a new workbook.
var workbook = new GrapeCity.Documents.Excel.Workbook();
IWorksheet worksheet = workbook.Worksheets[0];

// Add a rounded rectangle shape.
GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddShape(GrapeCity.Documents.Excel.Drawing.AutoShapeType.RoundedRectangle, 10, 10, 200, 100);

// Set alternative text.
shape.Title = "Test Shape";
shape.AlternativeText = "This is a rounded rectangle.";

// Save to an excel file.
workbook.Save("SetShapeAltText.xlsx");
```

The output is shown in the figure below:
![image-20250430-020659](https://cdn.mescius.io/document-site-files/images/eb4435e4-a680-434b-9ede-1201b30ba868/image-20250430-020659.65078b.png)

## Mark as Decorative

Refer to the following sample code to mark the shape as decorative.

```csharp
// Create a new workbook.
var workbook = new GrapeCity.Documents.Excel.Workbook();
IWorksheet worksheet = workbook.Worksheets[0];

// Add a rounded rectangle shape.
GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddShape(GrapeCity.Documents.Excel.Drawing.AutoShapeType.RoundedRectangle, 10, 10, 200, 100);

// Set alternative text.
shape.Title = "Test Shape";
shape.AlternativeText = "This is a rounded rectangle.";

// When a shape is marked as decorative, the alternative text will be cleared.
shape.Decorative = true;

// Save to an excel file.
workbook.Save("SetShapeAltText.xlsx");
```

The output is shown in the figure below:
![image-20250430-013735](https://cdn.mescius.io/document-site-files/images/eb4435e4-a680-434b-9ede-1201b30ba868/image-20250430-013735.2beeff.png)