Class ExcelExporter

java.lang.Object
io.jmix.gridexportflowui.exporter.AbstractDataGridExporter<ExcelExporter>
io.jmix.gridexportflowui.exporter.excel.ExcelExporter
All Implemented Interfaces:
DataGridExporter

@Component("grdexp_ExcelExporter") @Scope("prototype") public class ExcelExporter extends AbstractDataGridExporter<ExcelExporter>
Use this class to export DataGrid 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
    • 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
    • isRowNumberExceeded

      protected boolean isRowNumberExceeded
    • gridExportProperties

      protected GridExportProperties gridExportProperties
    • excelAllRecordsExporter

      protected ExcelAllRecordsExporter excelAllRecordsExporter
    • notifications

      protected Notifications notifications
  • Constructor Details

  • Method Details

    • createWorkbookWithSheet

      protected void createWorkbookWithSheet()
    • createFonts

      protected void createFonts()
    • createAutoColumnSizers

      protected void createAutoColumnSizers(int count)
    • exportDataGrid

      public void exportDataGrid(Downloader downloader, com.vaadin.flow.component.grid.Grid<Object> dataGrid, ExportMode exportMode)
      Description copied from interface: DataGridExporter
      download dataGrid content via downloader
    • getColumnHeaderText

      protected String getColumnHeaderText(com.vaadin.flow.component.grid.Grid.Column<?> column)
    • createDataGridHierarchicalRow

      protected int createDataGridHierarchicalRow(com.vaadin.flow.component.treegrid.TreeGrid<?> dataGrid, ContainerTreeDataGridItems<Object> treeDataGridItems, List<com.vaadin.flow.component.grid.Grid.Column<Object>> columns, int startColumn, int rowNumber, Object item)
    • createDataGridRow

      protected void createDataGridRow(com.vaadin.flow.component.grid.Grid<?> dataGrid, List<com.vaadin.flow.component.grid.Grid.Column<Object>> columns, int startColumn, int rowNumber, Object itemId)
    • createDataGridRowForEntityInstance

      protected void createDataGridRowForEntityInstance(com.vaadin.flow.component.grid.Grid<?> dataGrid, List<com.vaadin.flow.component.grid.Grid.Column<Object>> columns, int startColumn, int rowNumber, Object entityInstance, boolean addLevelPadding)
    • createInstanceContainerProvider

      protected Function<Object,InstanceContainer<Object>> createInstanceContainerProvider(com.vaadin.flow.component.grid.Grid<?> dataGrid, Object item)
      Overrides:
      createInstanceContainerProvider in class AbstractDataGridExporter<ExcelExporter>
    • createFormats

      protected void createFormats()
    • getBuiltinFormat

      protected short getBuiltinFormat(String format)
    • getMessage

      protected String getMessage(String id)
    • 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)
    • isXlsxMaxRowNumberExceeded

      protected boolean isXlsxMaxRowNumberExceeded()
      Returns:
      true if exported table contains more than MAX_ROW_COUNT records
    • showWarnNotification

      protected void showWarnNotification()
    • getExportAggregation

      public boolean getExportAggregation()
      Returns:
      export aggregation
    • setExportAggregation

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

      public ExcelExporter withExportAggregation(Boolean exportAggregation)
      Export table with aggregation
      Parameters:
      exportAggregation - set to true to export table with aggregation
      Returns:
      exporter instance
    • 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
    • getLabel

      public String getLabel()
      Returns:
      exporter label
    • disposeWorkBook

      protected void disposeWorkBook()