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
Constructor | Description |
---|---|
constructor(Worksheet, ImageOrPrintOptions) | the construct of SheetRender, need worksheet and ImageOrPrintOptions as params |
Properties
Property | Type | Description |
---|---|---|
pageCount | number | Readonly. Gets the total page count of current worksheet. |
pageScale | number | Readonly. 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. |
Methods
Method | Description |
---|---|
getPageCount() | @deprecated. Please use the ‘pageCount’ property instead. Gets the total page count of current worksheet. |
getPageScale() | @deprecated. Please use the ‘pageScale’ property instead. 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. |
toImageAsync(number, string) | Render certain page to a file. |
toImageAsync(number) | Render certain page to a stream. |
toTiff() | Render whole worksheet as Tiff Image to stream. |
toTiff(string) | Render whole worksheet as Tiff Image to a file. |
toTiffAsync() | Render whole worksheet as Tiff Image to stream. |
toTiffAsync(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 |
pageCount
Readonly. Gets the total page count of current worksheet.
pageCount : number;
pageScale
Readonly. 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.
pageScale : number;
getPageCount()
@deprecated. Please use the ‘pageCount’ property instead. Gets the total page count of current worksheet.
getPageCount() : number;
getPageScale()
@deprecated. Please use the ‘pageScale’ property instead. 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
toImageAsync(number, string)
Render certain page to a file.
toImageAsync(pageIndex: number, fileName: string) : Promise<void>;
Parameters:
Parameter | Type | Description |
---|---|---|
pageIndex | number | indicate which page is to be converted |
fileName | string | filename of the output image |
Returns
toImageAsync(number)
Render certain page to a stream.
toImageAsync(pageIndex: number) : Promise<Uint8Array>;
Parameters:
Parameter | Type | Description |
---|---|---|
pageIndex | number | indicate which page is to be converted |
Returns
The result stream
toTiff()
Render whole worksheet as Tiff Image to stream.
toTiff() : Uint8Array;
Returns
The result stream
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 |
toTiffAsync()
Render whole worksheet as Tiff Image to stream.
toTiffAsync() : Promise<Uint8Array>;
Returns
The result stream
toTiffAsync(string)
Render whole worksheet as Tiff Image to a file.
toTiffAsync(filename: string) : Promise<void>;
Parameters:
Parameter | Type | Description |
---|---|---|
filename | string | the filename of the output image |
Returns
dispose()
Releases resources created and used for rendering.
dispose() : void;
isNull()
Checks whether the implementation object is null.
isNull() : boolean;