Class ExcelSubtotalFunction

java.lang.Object
org.adempiere.impexp.ExcelSubtotalFunction

public final class ExcelSubtotalFunction extends Object
Excel SUBTOTAL function codes and formula builder shared by the XLS and XLSX exporters.
SUBTOTAL ignores other SUBTOTAL cells within its range, which allows nested group and grand totals.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    SUBTOTAL function code for AVERAGE
    static final int
    SUBTOTAL function code for COUNTA (non-empty count)
    static final int
    SUBTOTAL function code for MAX
    static final int
    SUBTOTAL function code for MIN
    static final int
    SUBTOTAL function code for STDEVP (population standard deviation)
    static final int
    SUBTOTAL function code for SUM
    static final int
    SUBTOTAL function code for VARP (population variance)
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getSubtotalFormula(int functionCode, int firstRow, int lastRow, int col)
    Build SUBTOTAL formula (without the leading =) for a column range
    static boolean
    isFunction(int functionCode)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SUM_FUNCTION

      public static final int SUM_FUNCTION
      SUBTOTAL function code for SUM
      See Also:
    • COUNT_FUNCTION

      public static final int COUNT_FUNCTION
      SUBTOTAL function code for COUNTA (non-empty count)
      See Also:
    • MIN_FUNCTION

      public static final int MIN_FUNCTION
      SUBTOTAL function code for MIN
      See Also:
    • MAX_FUNCTION

      public static final int MAX_FUNCTION
      SUBTOTAL function code for MAX
      See Also:
    • VAR_FUNCTION

      public static final int VAR_FUNCTION
      SUBTOTAL function code for VARP (population variance)
      See Also:
    • AVG_FUNCTION

      public static final int AVG_FUNCTION
      SUBTOTAL function code for AVERAGE
      See Also:
    • STDEV_FUNCTION

      public static final int STDEV_FUNCTION
      SUBTOTAL function code for STDEVP (population standard deviation)
      See Also:
  • Method Details

    • isFunction

      public static boolean isFunction(int functionCode)
      Parameters:
      functionCode - SUBTOTAL function code
      Returns:
      true if functionCode is a valid function code (i.e. cell should be exported as formula)
    • getSubtotalFormula

      public static String getSubtotalFormula(int functionCode, int firstRow, int lastRow, int col)
      Build SUBTOTAL formula (without the leading =) for a column range
      Parameters:
      functionCode - SUBTOTAL function code (SUM_FUNCTION, COUNT_FUNCTION, etc.)
      firstRow - first row index (0 based) of range
      lastRow - last row index (0 based) of range
      col - column index (0 based)
      Returns:
      formula, for e.g. SUBTOTAL(9,C2:C10)