new WorkbookRender(workbook, options)

The construct of WorkbookRender

Parameters

Name Type Optional Description

workbook

 

 

Indicate which workbook to be rendered.

options

 

 

ImageOrPrintOptions contains some property of output image

Methods

getPageCount()

Gets the total page count of workbook.

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(filename)

Render whole workbook as Tiff Image to a file.

Parameter

Name Type Optional Description

filename

String

 

the filename of the output image

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

toImage(pageIndex, stream)

Render certain page to a stream.

Parameters

Name Type Optional Description

pageIndex

Number

 

indicate which page is to be converted

stream

OutputStream

 

the stream of the output image

toPrinter(printerName)

Render workbook 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 workbook 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

static

toImageStream(workbookRender, stream)

Render whole workbook as Tiff Image to 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.setSaveFormat(aspose.cells.SaveFormat.XPS);
var workbookRender = new aspose.cells.WorkbookRender(workbook, imgOptions);
var imgWriteStream = fs.createWriteStream("workbook.xps");
aspose.cells.WorkbookRender.toImageStream(workbookRender, imgWriteStream);

Parameters

Name Type Optional Description

workbookRender

WorkbookRender

 

The WorkbookRender object

stream

WritableStream

 

The stream of the output image