ChartSheetExtensions.CreateThumbnail(ChartSheet, String, ImageFileFormat, Int32, Int32) Method
Saves the chart sheet as an image in the specified format and allows you to set the image size.
You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this method in production code.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Docs.v24.1.dll
NuGet Package: DevExpress.Document.Processor
Declaration
public static void CreateThumbnail(
this ChartSheet chartSheet,
string fileName,
ImageFileFormat format,
int width,
int height
)
Parameters
Name | Type | Description |
---|---|---|
chartSheet | ChartSheet | The chart sheet to be saved as an image. |
fileName | String | The file name (including full path) for the output image. |
format | ImageFileFormat | The output image format. |
width | Int32 | The output image width in pixels. |
height | Int32 | The output image height in pixels. |
Remarks
If the chart sheet is bigger than the thumbnail, the chart sheet is cropped to fit the thumbnail. If the chart sheet is smaller, the remaining space is filled with the default background color.
The code sample below saves a chart sheet as an image:
using DevExpress.Spreadsheet;
// ...
// Create a new Workbook object.
using (Workbook workbook = new Workbook())
{
// Load a workbook from a file.
workbook.LoadDocument("VariableCosts.xlsx", DocumentFormat.Xlsx);
// Access an active chart sheet.
ChartSheet chartSheet = workbook.ChartSheets.ActiveChartSheet;
// Save the chart sheet as an image.
if (chartSheet != null)
chartSheet.CreateThumbnail("Chart_sheet_Thumbnail.png", ImageFileFormat.Png, 920, 670);
}