asposecells.api

Class DataBar

Describe the DataBar conditional formatting rule. This conditional formatting rule displays a gradated data bar in the range of cells.

Example:

# Instantiating a Workbook object
workbook = Workbook()
sheet = workbook.getWorksheets().get(0)

# Adds an empty conditional formatting
index = sheet.getConditionalFormattings().add()
fcs = sheet.getConditionalFormattings().get(index)

# Sets the conditional format range.
ca = CellArea()
ca.StartRow = 0
ca.EndRow = 2
ca.StartColumn = 0
ca.EndColumn = 0
fcs.addArea(ca)

# Adds condition.
idx = fcs.addCondition(FormatConditionType.DATA_BAR)
fcs.addArea(ca)
cond = fcs.get(idx)

# Get Databar
dataBar = cond.getDataBar()
dataBar.setColor(Color.getOrange())

# Set Databar properties
dataBar.getMinCfvo().setType(FormatConditionValueType.PERCENTILE)
dataBar.getMinCfvo().setValue(30)
dataBar.setShowValue(False)

# Put Cell Values
cell1 = sheet.getCells().get("A1")
cell1.putValue(10)
cell2 = sheet.getCells().get("A2")
cell2.putValue(120)
cell3 = sheet.getCells().get("A3")
cell3.putValue(260)

# Saving the Excel file
workbook.save("Book1.xlsx")

Property Getters/Setters Summary
methodgetAxisColor()
method
           Gets the color of the axis for cells with conditional formatting as data bars.
methodgetAxisPosition()
method
           Gets or sets the position of the axis of the data bars specified by a conditional formatting rule. The value of the property is DataBarAxisPosition integer constant.
methodgetBarBorder()
Gets an object that specifies the border of a data bar.
methodgetBarFillType()
method
           Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant.
methodgetColor()
method
setColor(value)
           Get or set this DataBar's Color.
methodgetDirection()
method
           Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.
methodgetMaxCfvo()
Get or set this DataBar's max value object. Cannot set null or CFValueObject with type FormatConditionValueType.Min to it.
methodgetMaxLength()
method
           Represents the max length of data bar .
methodgetMinCfvo()
Get or set this DataBar's min value object. Cannot set null or CFValueObject with type FormatConditionValueType.Max to it.
methodgetMinLength()
method
           Represents the min length of data bar .
methodgetNegativeBarFormat()
Gets the NegativeBarFormat object associated with a data bar conditional formatting rule.
methodgetShowValue()
method
           Get or set the flag indicating whether to show the values of the cells on which this data bar is applied. Default value is true.
 
Method Summary
methodtoImage(cell, imgOpts)
Render data bar in cell to image byte array.
 

    • Property Getters/Setters Detail

      • getAxisColor/setAxisColor : Color 

        Color getAxisColor() / setAxisColor(value)
        
        Gets the color of the axis for cells with conditional formatting as data bars.
      • getAxisPosition/setAxisPosition : int 

        int getAxisPosition() / setAxisPosition(value)
        
        Gets or sets the position of the axis of the data bars specified by a conditional formatting rule. The value of the property is DataBarAxisPosition integer constant.
      • getBarFillType/setBarFillType : int 

        int getBarFillType() / setBarFillType(value)
        
        Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant.
      • getDirection/setDirection : int 

        int getDirection() / setDirection(value)
        
        Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.
      • getNegativeBarFormat : NegativeBarFormat 

        NegativeBarFormat getNegativeBarFormat()
        
        Gets the NegativeBarFormat object associated with a data bar conditional formatting rule.
      • getColor/setColor : Color 

        Color getColor() / setColor(value)
        
        Get or set this DataBar's Color.
      • getMinLength/setMinLength : int 

        int getMinLength() / setMinLength(value)
        
        Represents the min length of data bar .
      • getMaxLength/setMaxLength : int 

        int getMaxLength() / setMaxLength(value)
        
        Represents the max length of data bar .
      • getShowValue/setShowValue : boolean 

        boolean getShowValue() / setShowValue(value)
        
        Get or set the flag indicating whether to show the values of the cells on which this data bar is applied. Default value is true.
    • Method Detail

      • toImage

        byte[] toImage(cell, imgOpts)
        Render data bar in cell to image byte array.
        Parameters:
        cell: Cell - Indicate the data bar in which cell to be rendered
        imgOpts: ImageOrPrintOptions - ImageOrPrintOptions contains some property of output image
        Returns: