WorkbookRender

WorkbookRender class

Represents a Workbook render. The constructor of this class , must be used after modification of pagesetup, cell style.

new WorkbookRender(workbook, options)

The construct of WorkbookRender

Methods

NameDescription
getPageCount()Gets the total page count of workbook.
getPageSizeInch(pageIndex)Get page size in inch of output image.
toImage(filename)Render whole workbook as Tiff Image to a file.
toImage(pageIndex, fileName)Render certain page to a file.
toImage(pageIndex, stream)Render certain page to a stream.
toPrinter(printerName)Render workbook to Printer
toPrinter(printerName, jobName)Render workbook to Printer
toImageStream(workbookRender, stream) (static)Render whole workbook as Tiff Image to stream.

getPageCount()

Gets the total page count of workbook.

getPageSizeInch(pageIndex)

Get page size in inch of output image.

ParameterTypeDescription
pageIndexNumberThe page index is based on zero.

Returns: Array of float — 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.

ParameterTypeDescription
filenameStringthe filename of the output image

toImage(pageIndex, fileName)

Render certain page to a file.

ParameterTypeDescription
pageIndexNumberindicate which page is to be converted
fileNameStringfilename of the output image

toImage(pageIndex, stream)

Render certain page to a stream.

ParameterTypeDescription
pageIndexNumberindicate which page is to be converted
streamOutputStreamthe stream of the output image

toPrinter(printerName)

Render workbook to Printer

ParameterTypeDescription
printerNameStringthe name of the printer , for example: “Microsoft Office Document Image Writer”

toPrinter(printerName, jobName)

Render workbook to Printer

ParameterTypeDescription
printerNameStringthe name of the printer , for example: “Microsoft Office Document Image Writer”
jobNameStringset the print job name

toImageStream(workbookRender, stream) (static)

Render whole workbook as Tiff Image to stream.

ParameterTypeDescription
workbookRenderWorkbookRenderThe WorkbookRender object
streamWritableStreamThe stream of the output image

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);