| Constructor Summary |
|---|
SheetRender(worksheet, options)
the construct of SheetRender, need worksheet and ImageOrPrintOptions as params |
| Property Getters/Setters Summary | ||
|---|---|---|
method | getPageCount() | |
Gets the total page count of current worksheet.
|
||
method | getPageScale() | |
Gets calculated page scale of the sheet.
Returns the set scale if |
||
| Method Summary | ||
|---|---|---|
method | getPageSizeInch(pageIndex) | |
Get page size in inch of output image.
|
||
method | toImage(pageIndex, fileName) | |
Render certain page to a file.
|
||
method | toImageBytes(pageIndex) | |
Render certain page to a byte array.
|
||
method | toPrinter(printerName) | |
Render worksheet to Printer
|
||
method | toPrinter(printerName, jobName) | |
Render worksheet to Printer
|
||
SheetRender(worksheet, options)
worksheet: Worksheet - Indicate which spreadsheet to be rendered.options: ImageOrPrintOptions - ImageOrPrintOptions contains some property of output imageint getPageCount()
float getPageScale()
float[] getPageSizeInch(pageIndex)
pageIndex: int - The page index is based on zero.toImage(pageIndex, fileName)
pageIndex: int - indicate which page is to be convertedfileName: String - filename of the output imagetoPrinter(printerName)
printerName: String - the name of the printer , for example: "Microsoft Office Document Image Writer"toPrinter(printerName, jobName)
printerName: String - the name of the printer , for example: "Microsoft Office Document Image Writer"jobName: String - set the print job name toImageBytes(pageIndex)
pageIndex: int - Indicate which page is to be convertedExample:
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()