ChartToImage Method (ImageOrPrintOptions)

Gets a 32-bit Bitmap object of the chart. ImageOrPrintOptions.ImageFormat, ImageOrPrintOptions.TiffCompression and ImageOrPrintOptions.Quality attributes are ignored.

Namespace:  Aspose.Cells.Charts
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: 20.9.0.0 (20.9)
Syntax
public Bitmap ToImage(
	ImageOrPrintOptions options
)

Parameters

options
Type: Aspose.Cells.RenderingImageOrPrintOptions
Addtional image creation options

Return Value

Type: Bitmap
the picture of the chart.
Remarks
Returns a 32-bit bitmap object, so ImageOrPrintOptions.ImageFormat, ImageOrPrintOptions.TiffCompression and ImageOrPrintOptions.Quality attributes do not affect the method. If the width or height is zero or the chart is not supported according to Supported Charts List, it will return null. Please refer to Supported Charts List for more details.
Examples
Gets a bitmap object with 200 x dpi and 300 y dpi.
[C#]
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.HorizontalResolution = 200;
options.VerticalResolution = 300;

Workbook book = new Workbook(@"c:\test.xls");
Bitmap chartObject = book.Worksheets[0].Charts[0].ToImage(options);

[VB]
Dim options As ImageOrPrintOptions =  New ImageOrPrintOptions() 
options.HorizontalResolution = 200
options.VerticalResolution = 300

Dim book As Workbook =  New Workbook("c:\test.xls")
Dim chartObject As Bitmap = book.Worksheets(0).Charts(0).ToImage(options)
See Also