Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introducedin
09.1

Description

Excerpt

Saves Writes a Chart as a specified image formatan image with the specified dimensions in pixels to the specified stream.

Signature
C#
C#
 public static void SaveImage(System.IO.Stream stream, ImageFormat imageFormat, int? width, int? height)
Signature
vb.net
vb.net
Public Static Sub SaveImage(ByVal stream As System.IO.stream, ByVal imageFormat As ImageFormat, ByVal width asAs int?, ByVal height asAs int?)

Parameters

Param
0stream

The output stream to write to. This stream must be open and writable. ExcelWriter will not close this stream; the calling program is responsible for closing the stream and releasing the resource.

...

Example
Code Block
csharp
csharp
titleC#
           ExcelApplication xla = new ExcelApplication();
           Workbook WB= xla.Create(FileFormat.Xlsx);
           Chart chartOne= WB[0].Charts[0];
           FileStream fstream = new FileStream(@"C:\temp\outfile.xls", FileMode.Create);           
           chartOne.SaveImage(fstream, System.Drawing.Imaging.ImageFormat.Png, 600, 400);            
Code Block
vb.net
vb.net
titlevb.net
	   Dim oExcelApp As New ExcelApplication()           
           Dim wb As Workbook = oExcelApp.Create(FileFormat.Xlsx) 
           Dim chartOne As Chart = WB[0].Charts[0]
           Dim fstream As New FileStream("C:\temp\outfile.xls", FileMode.Create)          
           chartOne.SaveImage(fstream, System.Drawing.Imaging.ImageFormat.PngmPng, 600, 400)