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
Name | Description |
---|---|
constructor(Worksheet, ImageOrPrintOptions) | the construct of SheetRender, need worksheet and ImageOrPrintOptions as params |
Methods
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
worksheet | Worksheet | Indicate which spreadsheet to be rendered. |
options | ImageOrPrintOptions | ImageOrPrintOptions 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:
Parameter | Type | Description |
---|---|---|
pageIndex | number | The 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:
Parameter | Type | Description |
---|---|---|
pageIndex | number | indicate which page is to be converted |
fileName | string | filename of the output image |
toImage(number)
Render certain page to a stream.
toImage(pageIndex: number) : Uint8Array;
Parameters:
Parameter | Type | Description |
---|---|---|
pageIndex | number | indicate 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:
Parameter | Type | Description |
---|---|---|
stream | Uint8Array | the stream of the output image |
toTiff(string)
Render whole worksheet as Tiff Image to a file.
toTiff(filename: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
filename | string | the 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;