asposecells.api

Class WorkbookRender

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

Constructor Summary
WorkbookRender(workbook, options)
The construct of WorkbookRender
 
Property Getters/Setters Summary
methodgetPageCount()
Gets the total page count of workbook.
 
Method Summary
methodgetPageSizeInch(pageIndex)
Get page size in inch of output image.
methodtoImage(pageIndex, stream)
Render certain page to a stream.
methodtoImage(pageIndex, fileName)
Render certain page to a file.
methodtoImage(filename)
Render whole workbook as Tiff Image to a file.
methodtoImageBytes()
Render whole workbook as Tiff Image to a byte array.
methodtoPrinter(printerName)
Render workbook to Printer
methodtoPrinter(printerName, jobName)
Render workbook to Printer
 

    • Constructor Detail

      • WorkbookRender

        WorkbookRender(workbook, options)
        The construct of WorkbookRender
        Parameters:
        workbook: Workbook - Indicate which workbook to be rendered.
        options: ImageOrPrintOptions - ImageOrPrintOptions contains some property of output image
    • Property Getters/Setters Detail

      • getPageCount : int 

        int getPageCount()
        
        Gets the total page count of workbook.
    • Method Detail

      • getPageSizeInch

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

         toImage(filename)
        Render whole workbook as Tiff Image to a file.
        Parameters:
        filename: String - the filename of the output image
      • 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
      • toImage

         toImage(pageIndex, stream)
        Render certain page to a stream.
        Parameters:
        pageIndex: int - indicate which page is to be converted
        stream: OutputStream - the stream of the output image
      • toPrinter

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

         toPrinter(printerName, jobName)
        Render workbook to Printer
        Parameters:
        printerName: String - the name of the printer , for example: "Microsoft Office Document Image Writer"
        jobName: String - set the print job name
      • toImageBytes

         toImageBytes()
        Render whole workbook as Tiff Image to a byte array.
        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.setSaveFormat(SaveFormat.XPS)
        workbookRender = WorkbookRender(wb, imgOptions)
        with open("workbook.xps", "wb") as w:
            content = workbookRender.toImageBytes()
            w.write(content)
        
        jpype.shutdownJVM()