new SheetRender(worksheet, options)

the construct of SheetRender, need worksheet and ImageOrPrintOptions as params

Parameters

Name Type Optional Description

worksheet

 

 

Indicate which spreadsheet to be rendered.

options

 

 

ImageOrPrintOptions contains some property of output image

Methods

static

toImageStream(sheetRender, pageIndex, stream)

Render certain page to a stream.

Example

var aspose = aspose || {};
aspose.cells = require("aspose.cells");
var fs = require("fs");
var workbook = new aspose.cells.Workbook("Book2.xlsx");
var imgOptions = new aspose.cells.ImageOrPrintOptions();
imgOptions.setHorizontalResolution(200);
imgOptions.setVerticalResolution(300);
imgOptions.setImageFormat(aspose.cells.ImageFormat.getJpeg());
var worksheet = workbook.getWorksheets().get(0);
var sheetRender = new aspose.cells.SheetRender(worksheet, imgOptions);
var imgWriteStream = fs.createWriteStream("sheet1.jpeg");
aspose.cells.SheetRender.toImageStream(sheetRender, 0, imgWriteStream);

Parameters

Name Type Optional Description

sheetRender

SheetRender

 

The SheetRender object

pageIndex

Number

 

Indicate which page is to be converted

stream

WritableStream

 

The stream of the output image

getPageCount()

Indicate the total page count of current worksheet

getPageScale() → Number

Gets calculated page scale of the sheet.

Returns

Number 

getPageSize(pageIndex) → Array of float

Get page size of output image. The size unit is in point. NOTE: This method is now obsolete. Instead, please use GetPageSizeInch(int pageIndex). This property will be removed 12 months later since October 2021. Aspose apologizes for any inconvenience you may have experienced.

Parameter

Name Type Optional Description

pageIndex

Number

 

The page index is based on zero.

Returns

Array of float Page size of image, [0] for width and [1] for height

getPageSizeInch(pageIndex) → Array of float

Get page size in inch of output image.

Parameter

Name Type Optional Description

pageIndex

Number

 

The page index is based on zero.

Returns

Array of float Page size of image, [0] for width and [1] for height

toImage(pageIndex, fileName)

Render certain page to a file.

Parameters

Name Type Optional Description

pageIndex

Number

 

indicate which page is to be converted

fileName

String

 

filename of the output image

toPrinter(printerName)

Render worksheet to Printer

Parameter

Name Type Optional Description

printerName

String

 

the name of the printer , for example: "Microsoft Office Document Image Writer"

toPrinter(printerName, jobName)

Render worksheet to Printer

Parameters

Name Type Optional Description

printerName

String

 

the name of the printer , for example: "Microsoft Office Document Image Writer"

jobName

String

 

set the print job name