ChartToImage Method (String, ImageOrPrintOptions) |
Namespace: Aspose.Cells.Charts
The format of the image is specified by using the extension of the file name. For example, if you specify "myfile.png", then the image will be saved in the PNG format. The following file extensions are recognized: .bmp, .gif, .png, .jpg, .jpeg, .tiff, .tif, .emf.
If the width or height is zero or the chart is not supported according to Supported Charts List, this method will do nothing. Please refer to Supported Charts List for more details.[C#] ImageOrPrintOptions options = new ImageOrPrintOptions(); options.HorizontalResolution = 300; options.VerticalResolution = 300; options.TiffCompression = TiffCompression.CompressionCCITT4; Workbook book = new Workbook(@"test.xls"); book.Worksheets[0].Charts[0].ToImage(@"chart.Tiff", options); [VB] Dim options As ImageOrPrintOptions = New ImageOrPrintOptions() options.HorizontalResolution = 300 options.VerticalResolution = 300 options.TiffCompression = TiffCompression.CompressionCCITT4 Dim book As Workbook = New Workbook("test.xls") book.Worksheets(0).Charts(0).ToImage("chart.Tiff", options)
[C#] ImageOrPrintOptions options = new ImageOrPrintOptions(); options.HorizontalResolution = 300; options.VerticalResolution = 300; options.Quality = 80; Workbook book = new Workbook(@"test.xls"); book.Worksheets[0].Charts[0].ToImage(@"chart.Jpeg", options); [VB] Dim options As ImageOrPrintOptions = New ImageOrPrintOptions() options.HorizontalResolution = 300 options.VerticalResolution = 300 options.Quality = 80 Dim book As Workbook = New Workbook("test.xls") book.Worksheets(0).Charts(0).ToImage("chart.Jpeg", options)