Class SubtotalHelper

java.lang.Object
io.keikai.range.impl.SubtotalHelper

public class SubtotalHelper extends Object
Helper class that implements the subtotal algorithm:
  1. Sort data by groupByCol
  2. Insert subtotal rows at group boundaries
  3. Insert SUBTOTAL formulas in totalCols
  4. Add outline grouping
  5. Add grand total at bottom
Since:
7.0.0
  • Method Details

    • applySubtotal

      public static void applySubtotal(SSheet sheet, CellRegion range, int groupByCol, SubtotalFunction function, int[] totalCols, boolean replace, boolean pageBreak, boolean summaryBelowData)
      Applies subtotals to the specified range on the sheet.
      Parameters:
      sheet - the sheet containing the data
      range - the data region (including header row)
      groupByCol - column index (0-based, relative to range) to group by
      function - the aggregation function
      totalCols - column indices (0-based, relative to range) to apply subtotals
      replace - true to remove existing subtotal rows first
      pageBreak - true to insert page breaks between groups
      summaryBelowData - true to put subtotal rows below groups