SheetRender

SheetRender class

Represents a worksheet render which can render worksheet to various images such as (BMP, PNG, JPEG, TIFF..) The constructor of this class , must be used after modification of pagesetup, cell style.

class SheetRender;

Constructors

NameDescription
constructor(Worksheet, ImageOrPrintOptions)the construct of SheetRender, need worksheet and ImageOrPrintOptions as params

Methods

MethodDescription
getPageCount()Gets the total page count of current worksheet.
getPageScale()Gets calculated page scale of the sheet. Returns the set scale if PageSetup.Zoom is set. Otherwise, returns the calculated scale according to PageSetup.FitToPagesWide and PageSetup.FitToPagesTall.
getPageSizeInch(number)Get page size in inch of output image.
toImage(number, string)Render certain page to a file.
toImage(number)Render certain page to a stream.
toTiff(Uint8Array)Render whole worksheet as Tiff Image to stream.
toTiff(string)Render whole worksheet as Tiff Image to a file.
dispose()Releases resources created and used for rendering.
isNull()Checks whether the implementation object is null.

constructor(Worksheet, ImageOrPrintOptions)

the construct of SheetRender, need worksheet and ImageOrPrintOptions as params

constructor(worksheet: Worksheet, options: ImageOrPrintOptions);

Parameters:

ParameterTypeDescription
worksheetWorksheetIndicate which spreadsheet to be rendered.
optionsImageOrPrintOptionsImageOrPrintOptions contains some property of output image

getPageCount()

Gets the total page count of current worksheet.

getPageCount() : number;

getPageScale()

Gets calculated page scale of the sheet. Returns the set scale if PageSetup.Zoom is set. Otherwise, returns the calculated scale according to PageSetup.FitToPagesWide and PageSetup.FitToPagesTall.

getPageScale() : number;

getPageSizeInch(number)

Get page size in inch of output image.

getPageSizeInch(pageIndex: number) : number[];

Parameters:

ParameterTypeDescription
pageIndexnumberThe page index is based on zero.

Returns

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

toImage(number, string)

Render certain page to a file.

toImage(pageIndex: number, fileName: string) : void;

Parameters:

ParameterTypeDescription
pageIndexnumberindicate which page is to be converted
fileNamestringfilename of the output image

toImage(number)

Render certain page to a stream.

toImage(pageIndex: number) : Uint8Array;

Parameters:

ParameterTypeDescription
pageIndexnumberindicate which page is to be converted

Returns

The result stream

toTiff(Uint8Array)

Render whole worksheet as Tiff Image to stream.

toTiff(stream: Uint8Array) : void;

Parameters:

ParameterTypeDescription
streamUint8Arraythe stream of the output image

toTiff(string)

Render whole worksheet as Tiff Image to a file.

toTiff(filename: string) : void;

Parameters:

ParameterTypeDescription
filenamestringthe filename of the output image

dispose()

Releases resources created and used for rendering.

dispose() : void;

isNull()

Checks whether the implementation object is null.

isNull() : boolean;