Class ExcelExporter

All Implemented Interfaces:
TableExporter

@Component("ui_ExcelExporter") @Scope("prototype") public class ExcelExporter extends AbstractTableExporter<ExcelExporter>
Use this class to export Table into Excel format
Just create an instance of ExportAction with withExporter method.
  • Field Details

    • COL_WIDTH_MAGIC

      protected static final int COL_WIDTH_MAGIC
      See Also:
    • MAX_ROW_COUNT

      public static final int MAX_ROW_COUNT
      See Also:
    • wb

      protected org.apache.poi.ss.usermodel.Workbook wb
    • boldFont

      protected org.apache.poi.ss.usermodel.Font boldFont
    • stdFont

      protected org.apache.poi.ss.usermodel.Font stdFont
    • sheet

      protected org.apache.poi.ss.usermodel.Sheet sheet
    • timeFormatCellStyle

      protected org.apache.poi.ss.usermodel.CellStyle timeFormatCellStyle
    • dateFormatCellStyle

      protected org.apache.poi.ss.usermodel.CellStyle dateFormatCellStyle
    • dateTimeFormatCellStyle

      protected org.apache.poi.ss.usermodel.CellStyle dateTimeFormatCellStyle
    • integerFormatCellStyle

      protected org.apache.poi.ss.usermodel.CellStyle integerFormatCellStyle
    • doubleFormatCellStyle

      protected org.apache.poi.ss.usermodel.CellStyle doubleFormatCellStyle
    • sizers

      protected ExcelAutoColumnSizer[] sizers
    • exportAggregation

      protected boolean exportAggregation
    • exportExpanded

      protected Boolean exportExpanded
    • exportFormat

      protected ExcelExporter.ExportFormat exportFormat
    • isRowNumberExceeded

      protected boolean isRowNumberExceeded
  • Constructor Details

    • ExcelExporter

      public ExcelExporter()
  • Method Details

    • createWorkbookWithSheet

      protected void createWorkbookWithSheet()
    • createFonts

      protected void createFonts()
    • createAutoColumnSizers

      protected void createAutoColumnSizers(int count)
    • exportTable

      public void exportTable(Downloader downloader, Table<Object> table, ExportMode exportMode)
      Description copied from interface: TableExporter
      download table content via downloader
    • exportDataGrid

      public void exportDataGrid(Downloader downloader, DataGrid<Object> dataGrid, ExportMode exportMode)
      Description copied from interface: TableExporter
      download dataGrid content via downloader
    • createDataGridHierarchicalRow

      protected int createDataGridHierarchicalRow(TreeDataGrid dataGrid, TreeDataGridItems<Object> treeDataGridItems, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object item)
    • createDataGridRow

      protected void createDataGridRow(DataGrid dataGrid, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object itemId)
    • createInstanceContainerProvider

      protected Function<Object,InstanceContainer<Object>> createInstanceContainerProvider(DataGrid dataGrid, Object item)
      Overrides:
      createInstanceContainerProvider in class AbstractTableExporter<ExcelExporter>
    • createFormats

      protected void createFormats()
    • createHierarchicalRow

      protected int createHierarchicalRow(TreeTable<Object> table, List<Table.Column<Object>> columns, Boolean exportExpanded, int rowNumber, Object itemId)
    • createAggregatableRow

      protected int createAggregatableRow(Table<Object> table, List<Table.Column<Object>> columns, int rowNumber, int aggregatableRow)
    • createGroupRow

      protected int createGroupRow(GroupTable<Object> table, List<Table.Column<Object>> columns, int rowNumber, GroupInfo<?> groupInfo, int groupNumber)
    • createRow

      protected void createRow(Table<Object> table, List<Table.Column<Object>> columns, int startColumn, int rowNumber, Object itemId)
    • createSpaceString

      protected String createSpaceString(int level)
    • formatValueCell

      protected void formatValueCell(org.apache.poi.ss.usermodel.Cell cell, @Nullable Object cellValue, @Nullable MetaPropertyPath metaPropertyPath, int sizersIndex, int notificationRequired, int level, @Nullable Integer groupChildCount)
    • checkIsRowNumberExceed

      protected boolean checkIsRowNumberExceed(int r)
    • isXlsMaxRowNumberExceeded

      protected boolean isXlsMaxRowNumberExceeded()
      Returns:
      true if exported table contains more than 65536 records
    • setExportAggregation

      public void setExportAggregation(boolean exportAggregation)
      Export table with aggregation
      Parameters:
      exportAggregation - set to true to export table with aggregation
    • getExportAggregation

      public boolean getExportAggregation()
      Returns:
      export aggregation
    • withExportAggregation

      public ExcelExporter withExportAggregation(Boolean exportAggregation)
      Export table with aggregation
      Parameters:
      exportAggregation - set to true to export table with aggregation
      Returns:
      exporter instance
    • hasAggregatableColumn

      protected boolean hasAggregatableColumn(Table<Object> table)
      Checks that at least one column in table is aggregatable.
      Parameters:
      table - table
      Returns:
      true if at least one column is aggregatable
    • getExportExpanded

      public Boolean getExportExpanded()
      Returns:
      tree table export expanded
    • setExportExpanded

      public void setExportExpanded(Boolean exportExpanded)
      Export tree table with expanded rows
      Parameters:
      exportExpanded - set to true to export collapsed items in expanded view
    • withExportExpanded

      public ExcelExporter withExportExpanded(Boolean exportExpanded)
      Export tree table with expanded rows
      Parameters:
      exportExpanded - set to true to export collapsed items in expanded view
      Returns:
      exporter instance
    • getCaption

      public String getCaption()
      Description copied from interface: TableExporter
      returns exporter caption