Click or drag to resize

IWorksheet SaveToImage Method (Stream, Int32, Int32, Int32, Int32, ImageType)

Converts range into image.
Examples
The following code illustrates how to convert the specified range into image with the specified type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Creat stream</para><para>Stream stream = new MemoryStream();</para><para>//Save to image</para><para>System.Drawing.Image image = worksheet.SaveToImage(stream,1, 1, 10, 20, Spire.Xls.ImageType.Bitmap);</para><para>image.Save("Sample.png", System.Drawing.Imaging.ImageFormat.Png);</para>

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
Image SaveToImage(
	Stream stream,
	int firstRow,
	int firstColumn,
	int lastRow,
	int lastColumn,
	ImageType imageType
)

Parameters

stream
Type: System.IO Stream
Output stream. It is ignored if null.
firstRow
Type: System Int32
One-based index of the first row to convert.
firstColumn
Type: System Int32
One-based index of the first column to convert.
lastRow
Type: System Int32
One-based index of the last row to convert.
lastColumn
Type: System Int32
One-based index of the last column to convert.
imageType
Type: Spire.Xls ImageType
Type of the image to create.

Return Value

Type: Image
Created image.
See Also