Back to Devexpress

Shape.ExportToImage() Method

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

latest2.6 KB
Original Source

Shape.ExportToImage() Method

Saves the drawing object as an image.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
OfficeImage ExportToImage()
vb
Function ExportToImage As OfficeImage

Returns

TypeDescription
OfficeImage

The resulting image.

|

Remarks

Use the ExportToImage method to export a drawing object (chart, picture, or shape) as an image. This method preserves all display settings applied to the drawing object (for instance, crop, outline, and effects).

The example below shows how to create a text box and save it as an image.

csharp
Shape textBox = worksheet.Shapes.AddTextBox(50, 120, 500, 250, "Spreadsheet");
textBox.Fill.SetSolidFill(Color.PowderBlue);
textBox.ExportToImage().NativeImage.Save("MyTextBox.png");
vb
Dim textBox As Shape = worksheet.Shapes.AddTextBox(50, 120, 500, 250, "Spreadsheet")
textBox.Fill.SetSolidFill(Color.PowderBlue)
textBox.ExportToImage().NativeImage.Save("MyTextBox.png")

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ExportToImage() method.

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.

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

csharp
{
    OfficeImage image = chart.ExportToImage();
    string description = await imageHelper.DescribeImageAsync(image);

See Also

Shape Interface

Shape Members

DevExpress.Spreadsheet Namespace