asposecells.api

Class Sparkline

A sparkline represents a tiny chart or graphic in a worksheet cell that provides a visual representation of data.

Property Getters/Setters Summary
methodgetColumn()
Gets the column index of the sparkline.
methodgetDataRange()
method
           Represents the data range of the sparkline.
methodgetRow()
Gets the row index of the sparkline.
 
Method Summary
methodtoImage(stream, options)
Converts a sparkline to an image.
methodtoImage(fileName, options)
Converts a sparkline to an image.
methodtoImageBytes(options)
Converts a sparkline to an image.
 

    • Property Getters/Setters Detail

      • getDataRange/setDataRange : String 

        String getDataRange() / setDataRange(value)
        
        Represents the data range of the sparkline.
      • getRow : int 

        int getRow()
        
        Gets the row index of the sparkline.
      • getColumn : int 

        int getColumn()
        
        Gets the column index of the sparkline.
    • Method Detail

      • toImage

         toImage(fileName, options)
        Converts a sparkline to an image.
        Parameters:
        fileName: String - The image file name.
        options: ImageOrPrintOptions - The image options
      • toImage

         toImage(stream, options)
        Converts a sparkline to an image.
        Parameters:
        stream: OutputStream - The image stream.
        options: ImageOrPrintOptions - The image options.
      • toImageBytes

         toImageBytes(options)
        Converts a sparkline to an image.
        Parameters:
        options: ImageOrPrintOptions - Addtional image creation options
        Returns:
        A byte array.

        Example:

        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        wb = Workbook("sparkline.xlsx")
        sparkline = wb.getWorksheets().get(0).getSparklineGroupCollection().get(0).getSparklineCollection().get(0)
        imgOptions = ImageOrPrintOptions()
        imgOptions.setHorizontalResolution(200)
        imgOptions.setVerticalResolution(300)
        imgOptions.setImageFormat(ImageFormat.getJpeg())
        with open("sparkline.jpeg", "wb") as w:
            content = sparkline.toImageBytes(imgOptions)
            w.write(content)
        
        jpype.shutdownJVM()