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()
Indicate the total page count of workbook
 
Method Summary
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, DocumentName)
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()
        
        Indicate the total page count of workbook
    • Method Detail

      • 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, DocumentName)
        Render workbook 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()
        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()