Back to Devexpress

Shape.AlternativeText Property

officefileapi-devexpress-dot-spreadsheet-dot-shape-5c6e47a4.md

latest5.8 KB
Original Source

Shape.AlternativeText Property

Gets or sets the descriptive (alternative) text for a drawing object.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
string AlternativeText { get; set; }
vb
Property AlternativeText As String

Property Value

TypeDescription
String

A String value specifying the alternative text.

|

Remarks

The AlternativeText property defines the alternative, text-based representation of a picture or chart content. This information can be useful for people with vision or cognitive impairments who may not be able to see or understand the object.

Set the Shape.Decorative property to true to mark that the drawing object does not contain meaningful content and is purely decorative.

The following code snippet specifies alternative text for an inserted picture:

csharp
using DevExpress.Spreadsheet;
//...

Workbook workbook = new Workbook();
workbook.BeginUpdate();
try {
    Worksheet worksheet = workbook.Worksheets[0];
    // Insert picture.
    Picture picture = worksheet.Pictures.AddPicture("Pictures\\x-docserver.png", worksheet.Cells["A1"]);
    picture.AlternativeText = "Excel file icons with error and data formats";
}
finally {
    workbook.EndUpdate();
}
vb
Imports DevExpress.Spreadsheet
'...
Private Sub SurroundingSub()
    Dim workbook As Workbook = New Workbook()
    workbook.BeginUpdate()

    Try
        Dim worksheet As Worksheet = workbook.Worksheets(0)
        Dim picture As Picture = worksheet.Pictures.AddPicture("Pictures\x-docserver.png", worksheet.Cells("A1"))
        picture.AlternativeText = "Excel file icons with error and data formats"
    Finally
        workbook.EndUpdate()
    End Try
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the AlternativeText property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/PictureActions.cs#L100

csharp
pic.Name = "Logo";
pic.AlternativeText = "Spreadsheet logo";
// Move a picture.

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/ShapeActions.cs#L91

csharp
pic.Name = "Candles";
pic.AlternativeText = "Candles snapshot";
pic.BorderWidth = 1;

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/PictureActions.cs#L55

csharp
pic.Name = "Logo";
pic.AlternativeText = "Spreadsheet Logo";
pic.BorderWidth = 1;

office-file-api-ai-implementation/CS/Controllers/AccessibilityController.cs#L76

csharp
string description = await imageHelper.DescribeImageAsync(image);
    chart.AlternativeText = description;
}

winforms-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_API_Part02/SpreadsheetActions/PictureActions.vb#L93

vb
pic.Name = "Logo"
pic.AlternativeText = "Spreadsheet logo"
' Move a picture.

wpf-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/ShapeActions.vb#L85

vb
pic.Name = "Candles"
pic.AlternativeText = "Candles snapshot"
pic.BorderWidth = 1

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/PictureActions.vb#L47

vb
pic.Name = "Logo"
pic.AlternativeText = "Spreadsheet Logo"
pic.BorderWidth = 1

See Also

Shape Interface

Shape Members

DevExpress.Spreadsheet Namespace