Skip to main content
All docs
V24.2
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Shape.ExportToImage(Stream, ImageFileFormat) Method

Saves the drawing object as an image in the specified format.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

void ExportToImage(
    Stream stream,
    ImageFileFormat format
)

#Parameters

Name Type Description
stream Stream

A stream used to save the output image.

format ImageFileFormat

The output image format.

#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.

Shape textBox = worksheet.Shapes.AddTextBox(50, 120, 500, 250, "Spreadsheet");
textBox.Fill.SetSolidFill(Color.PowderBlue);
using (FileStream imageStream = new FileStream("MyTextBox.png", FileMode.Create))
{
    textBox.ExportToImage(imageStream, ImageFileFormat.Png);
}
See Also