GridSheetRender.ToImage

ToImage(int, Graphics, float, float, float, float)

Render certain page to a Graphics

public void ToImage(int pageIndex, Graphics g, float x, float y, float width, float height)
ParameterTypeDescription
pageIndexInt32indicate which page is to be converted
gGraphicsThe object where to render to.
xSingleThe X coordinate (in pixels) of the top left corner of the rendered page.
ySingleThe Y coordinate (in pixels) of the top left corner of the rendered page.
widthSingleThe maximum width (in pixels) that can be occupied by the rendered page.
heightSingleThe maximum height (in pixels) that can be occupied by the rendered page.

See Also


ToImage(int, Graphics, float, float)

Render certain page to a Graphics

public void ToImage(int pageIndex, Graphics g, float x, float y)
ParameterTypeDescription
pageIndexInt32indicate which page is to be converted
gGraphicsThe object where to render to.
xSingleThe X coordinate (in pixels) of the top left corner of the rendered page.
ySingleThe Y coordinate (in pixels) of the top left corner of the rendered page.

See Also


ToImage(int, string)

Render certain page to a file.

public void ToImage(int pageIndex, string fileName)
ParameterTypeDescription
pageIndexInt32indicate which page is to be converted
fileNameStringfilename of the output image

Examples

The following code outputs the first page of the first sheet to png image.

//load the source file with images.
Workbook wb = new Workbook("Book1.xlsx");

ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();

//set output image type.
imgOpt.ImageType = ImageType.Png;

//render the first sheet.
SheetRender sr = new SheetRender(wb.Worksheets[0], imgOpt);

//output the first page of the sheet to image.
sr.ToImage(0, "output.png");

See Also


ToImage(int, Stream)

Render certain page to a stream.

public void ToImage(int pageIndex, Stream stream)
ParameterTypeDescription
pageIndexInt32indicate which page is to be converted
streamStreamthe stream of the output image

See Also


ToImage(int)

Render certain page to a Bitmap object.

public Bitmap ToImage(int pageIndex)
ParameterTypeDescription
pageIndexInt32indicate which page is to be converted

Return Value

the bitmap object of the page

See Also