Class ExcelSummary

java.lang.Object
io.github.dornol.excelkit.excel.ExcelSummary

public class ExcelSummary extends Object
Fluent DSL for adding summary (footer) rows with formulas such as SUM, AVERAGE, COUNT, MIN, MAX.

Usage:


 writer
     .summary(s -> s
         .label("Total")
         .sum("Amount")
         .average("Score"))
     .write(data);
 
Since:
0.7.2
  • Constructor Details

    • ExcelSummary

      public ExcelSummary()
      Creates a new summary configuration.
  • Method Details

    • label

      public ExcelSummary label(String text)
      Sets the label text for the summary row(s). The label is placed in the first column by default.
      Parameters:
      text - the label text (e.g., "Total", "Summary")
      Returns:
      this summary for chaining
    • label

      public ExcelSummary label(String columnName, String text)
      Sets the label text for the summary row(s) in a specific column.
      Parameters:
      columnName - the column to place the label in
      text - the label text
      Returns:
      this summary for chaining
    • sum

      public ExcelSummary sum(String columnName)
      Adds a SUM formula for the specified column.
      Parameters:
      columnName - the target column name
      Returns:
      this summary for chaining
    • average

      public ExcelSummary average(String columnName)
      Adds an AVERAGE formula for the specified column.
      Parameters:
      columnName - the target column name
      Returns:
      this summary for chaining
    • count

      public ExcelSummary count(String columnName)
      Adds a COUNT formula for the specified column.
      Parameters:
      columnName - the target column name
      Returns:
      this summary for chaining
    • min

      public ExcelSummary min(String columnName)
      Adds a MIN formula for the specified column.
      Parameters:
      columnName - the target column name
      Returns:
      this summary for chaining
    • max

      public ExcelSummary max(String columnName)
      Adds a MAX formula for the specified column.
      Parameters:
      columnName - the target column name
      Returns:
      this summary for chaining