[]
        
(Showing Draft Content)

IAboveAverage

Interface IAboveAverage


public interface IAboveAverage
Represents a conditional formatting rule that evaluates cell values by comparing them with the range average or a standard deviation threshold.

Use this interface to configure a rule that matches values above average, below average, equal to or above average, equal to or below average, above the standard deviation, or below the standard deviation.


 worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
 IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
 format.getInterior().setColor(Color.GetYellow());
 format.setAboveBelow(AboveBelow.BelowAverage);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes this conditional format.
    void
    Generates the conditional format from the json string.
    Returns one of the constants of the AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold.
    Returns a range object specifying the cell range to which the formatting rule is applied.
    Returns an instance of IBorders which represents the borders of this conditional format.
    Returns an instance of IFont which represents the font of this conditional format.
    Returns an instance of IInterior which represents the background color of this conditional format.
    Returns the number format applied to a cell if the conditional formatting rule evaluates to true.
    int
    Gets the numeric standard deviation for an AboveAverage object.
    int
    Gets the priority value of the conditional formatting rule.
    boolean
    Returns a boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
    Returns the type of this conditional format.
    void
    Sets one of the constants of the AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold.
    void
    Sets a range object specifying the cell range to which the formatting rule is applied.
    void
    Sets the priority value for this conditional formatting rule to 1 so that it will be evaluated before all other rules on the worksheet.
    void
    Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.
    void
    Sets the number format applied to a cell if the conditional formatting rule evaluates to true.
    void
    setNumStdDev(int value)
    Sets the numeric standard deviation for an AboveAverage object.
    void
    setPriority(int value)
    Sets the priority value of the conditional formatting rule.
    void
    setStopIfTrue(boolean value)
    Sets a boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
    Generates a json string from the conditional format.
  • Method Details

    • getAboveBelow

      AboveBelow getAboveBelow()
      Returns one of the constants of the AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold.

      Use this method to determine whether the rule evaluates values that are above average, below average, equal to or above average, equal to or below average, above the standard deviation, or below the standard deviation.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setAboveBelow(AboveBelow.BelowAverage);
       AboveBelow aboveBelow = format.getAboveBelow();
       
      Returns:
      One of the AboveBelow constants that specifies whether the conditional formatting rule evaluates cell values against the range average or the standard deviation threshold.
    • setAboveBelow

      void setAboveBelow(AboveBelow value)
      Sets one of the constants of the AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold.

      Use this method to control whether the rule evaluates values that are above average, below average, equal to or above average, equal to or below average, above the standard deviation, or below the standard deviation.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setAboveBelow(AboveBelow.BelowAverage);
       
      Parameters:
      value - One of the AboveBelow constants that specifies whether the conditional formatting rule evaluates cell values against the range average or the standard deviation threshold; must not be null.
    • getAppliesTo

      IRange getAppliesTo()
      Returns a range object specifying the cell range to which the formatting rule is applied.

      Use this method to retrieve the target range of the current above-average conditional formatting rule.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setAppliesTo(worksheet.getRange("B1:B5"));
       IRange range = format.getAppliesTo();
       
      Returns:
      The range object specifying the cell range to which the formatting rule is applied.
    • setAppliesTo

      void setAppliesTo(IRange value)
      Sets a range object specifying the cell range to which the formatting rule is applied.

      Use this method to reassign an existing above-average conditional formatting rule to a different IRange.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setAppliesTo(worksheet.getRange("B1:B5"));
       
      Parameters:
      value - The IRange object that specifies the cell range to which the formatting rule is applied.
    • getBorders

      IBorders getBorders()
      Returns an instance of IBorders which represents the borders of this conditional format.

      Use the returned IBorders object to configure the border style that is applied when this above-average conditional formatting rule evaluates to true.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       IBorders borders = format.getBorders();
       borders.setColor(Color.GetRed());
       
      Returns:
      An IBorders instance that represents the borders of this conditional format.
    • getFont

      IFont getFont()
      Returns an instance of IFont which represents the font of this conditional format.
      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       IFont font = format.getFont();
       font.setBold(true);
       
      Returns:
      The IFont instance that represents the font of this conditional format.
    • getInterior

      IInterior getInterior()
      Returns an instance of IInterior which represents the background color of this conditional format.

      Use the returned IInterior object to access or modify the fill settings applied when the above-average conditional formatting rule is in effect.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       IInterior interior = format.getInterior();
       interior.setColor(Color.GetYellow());
       
      Returns:
      An instance of IInterior that represents the background color of this conditional format.
    • getNumberFormat

      String getNumberFormat()
      Returns the number format applied to a cell if the conditional formatting rule evaluates to true.

      Use this method to retrieve the format code currently configured for an above-average conditional formatting rule.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setNumberFormat("0.00");
       String numberFormat = format.getNumberFormat();
       
      Returns:
      The number format string applied when the conditional formatting rule evaluates to true.
    • setNumberFormat

      void setNumberFormat(String value)
      Sets the number format applied to a cell if the conditional formatting rule evaluates to true.

      Use this method to set the number format applied when the above-average conditional formatting rule evaluates to true.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setNumberFormat("0.00");
       
      Parameters:
      value - The number format string applied when the conditional formatting rule evaluates to true.
    • getNumStdDev

      int getNumStdDev()
      Gets the numeric standard deviation for an AboveAverage object.

      Use this method to get the standard deviation value assigned to the above-average conditional formatting rule.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setNumStdDev(2);
       int numStdDev = format.getNumStdDev();
       
      Returns:
      The numeric standard deviation for the above average rule.
    • setNumStdDev

      void setNumStdDev(int value)
      Sets the numeric standard deviation for an AboveAverage object.

      Use this method to set the standard deviation value assigned to the above-average conditional formatting rule.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setNumStdDev(2);
       
      Parameters:
      value - The numeric standard deviation for the above average rule.
    • getPriority

      int getPriority()
      Gets the priority value of the conditional formatting rule.

      The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

      When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       IAboveAverage condition = worksheet.getRange("B1:B5").getFormatConditions().addAboveAverage();
       condition.getInterior().setColor(Color.GetLightBlue());
       format.setPriority(2);
       int priority = format.getPriority();
       
      Returns:
      The priority value of the conditional formatting rule.
    • setPriority

      void setPriority(int value)
      Sets the priority value of the conditional formatting rule.

      The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.

      When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       IAboveAverage condition = worksheet.getRange("B1:B5").getFormatConditions().addAboveAverage();
       condition.getInterior().setColor(Color.GetLightBlue());
       format.setPriority(2);
       
      Parameters:
      value - The priority value of the conditional formatting rule.
    • getStopIfTrue

      boolean getStopIfTrue()
      Returns a boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setStopIfTrue(true);
       boolean stopIfTrue = format.getStopIfTrue();
       
      Returns:
      A boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
    • setStopIfTrue

      void setStopIfTrue(boolean value)
      Sets a boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setStopIfTrue(true);
       
      Parameters:
      value - A boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
    • getType

      Returns the type of this conditional format.

      For an IAboveAverage rule, this method returns FormatConditionType.AboveAverageCondition.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       FormatConditionType type = format.getType();
       
      Returns:
      The conditional format type.
    • delete

      void delete()
      Deletes this conditional format.

      Use this method to remove an above-average conditional formatting rule that was previously added to a range.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.delete();
       
    • setFirstPriority

      void setFirstPriority()
      Sets the priority value for this conditional formatting rule to 1 so that it will be evaluated before all other rules on the worksheet.

      Use setLastPriority() to move the rule to the end of the worksheet's conditional formatting evaluation order.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       ITop10 top10 = worksheet.getRange("A1:A5").getFormatConditions().addTop10();
       top10.getInterior().setColor(Color.GetYellow());
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetLightBlue());
       format.setFirstPriority();
       
    • setLastPriority

      void setLastPriority()
      Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

      Use this method to move the rule to the end of the worksheet-level conditional formatting priority order when multiple rules exist.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       ITop10 top10 = worksheet.getRange("A1:A5").getFormatConditions().addTop10();
       top10.getInterior().setColor(Color.GetYellow());
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetLightBlue());
       format.setLastPriority();
       
    • fromJson

      void fromJson(String json)
      Generates the conditional format from the json string.

      Use this method to restore the settings of an above average conditional format from a JSON string, such as one generated by toJson().

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       String json = "{\"ranges\":[{\"row\":0,\"col\":1,\"rowCount\":5,\"colCount\":1}],\"priority\":1,\"ruleType\":8,\"type\":0}";
       IAboveAverage format = worksheet.getRange("B1:B5").getFormatConditions().addAboveAverage();
       format.fromJson(json);
       format.getInterior().setColor(Color.GetYellow());
       
      Parameters:
      json - The JSON string that defines the conditional format.
    • toJson

      String toJson()
      Generates a json string from the conditional format.

      The returned string contains the serialized state of this IAboveAverage rule and can be used with fromJson(String) to restore the conditional format.

      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
       IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
       format.getInterior().setColor(Color.GetYellow());
       format.setAboveBelow(AboveBelow.AboveAverage);
       String json = format.toJson();
       
      Returns:
      The conditional format json string.