asposecells.api
Class SheetRender

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.

Constructor Summary
SheetRender(worksheet, options)
           the construct of SheetRender, need worksheet and ImageOrPrintOptions as params
 
Property Getters/Setters Summary
methodgetPageCount()
           Indicate the total page count of current worksheet
methodgetPageScale()
           Gets calculated page scale of the sheet.
 
Method Summary
methodgetPageSize(pageIndex)
           Get page size of output image. The size unit is in point.
methodtoImage(pageIndex, fileName)
           Render certain page to a file.
methodtoImageBytes(pageIndex)
           Render certain page to a byte array.
methodtoPrinter(PrinterName)
           Render worksheet to Printer
methodtoPrinter(PrinterName, DocumentName)
           Render worksheet to Printer
 

Constructor Detail

SheetRender

SheetRender(worksheet, options)
the construct of SheetRender, need worksheet and ImageOrPrintOptions as params
Parameters:
worksheet: Worksheet - Indicate which spreadsheet to be rendered.
options: ImageOrPrintOptions - ImageOrPrintOptions contains some property of output image

Property Getters/Setters Detail

getPageCount : int 

int getPageCount()
Indicate the total page count of current worksheet

getPageScale : float 

float getPageScale()
Gets calculated page scale of the sheet.
Returns:

Method Detail

getPageSize

float[] getPageSize(pageIndex)
Get page size of output image. The size unit is in point.
Parameters:
pageIndex: int - The page index is based on zero.
Returns:
Page size of image, [0] for width and [1] for height

toImage

 toImage(pageIndex, fileName)
Render certain page to a file.
Parameters:
pageIndex: int - indicate which page is to be converted
fileName: String - filename of the output image

toPrinter

 toPrinter(PrinterName)
Render worksheet to Printer
Parameters:
PrinterName: String - the name of the printer , for example: "Microsoft Office Document Image Writer"

toPrinter

 toPrinter(PrinterName, DocumentName)
Render worksheet to Printer
Parameters:
PrinterName: String - the name of the printer , for example: "Microsoft Office Document Image Writer"
DocumentName: String - set the print job name

toImageBytes

 toImageBytes(pageIndex)
Render certain page to a byte array.
Parameters:
pageIndex: int - Indicate which page is to be converted
Returns:
A byte array.

Example:

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *

wb = Workbook("Book2.xlsx")
imgOptions = ImageOrPrintOptions()
imgOptions.setHorizontalResolution(200)
imgOptions.setVerticalResolution(300)
imgOptions.setImageFormat(ImageFormat.getJpeg())
worksheet = wb.getWorksheets().get(0)
sheetRender = SheetRender(worksheet, imgOptions)
with open("sheet1.jpeg", "wb") as w:
    content = sheetRender.toImageBytes(0)
    w.write(content)

jpype.shutdownJVM()
				

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.