Class PivotExcelExporter

java.lang.Object
io.jmix.pivottable.component.impl.PivotExcelExporter

@Component("ui_PivotExcelExporter") @Scope("prototype") public class PivotExcelExporter extends Object
Exports PivotData to XLS file.
  • Field Details

    • MAX_ROW_INDEX

      public static final int MAX_ROW_INDEX
      See Also:
    • COLUMN_WIDTH_MULTIPLIER

      protected static final int COLUMN_WIDTH_MULTIPLIER
      CAUTION Magic number! This multiplier is used for calculating column width. Without this multiplier all columns in the file will be collapsed.
      See Also:
    • DEFAULT_FILE_NAME

      public static final String DEFAULT_FILE_NAME
      See Also:
    • exportFormat

      protected PivotExcelExporter.ExportFormat exportFormat
    • wb

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

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

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

      protected org.apache.poi.ss.usermodel.CellStyle cellLabelBoldStyle
    • cellDateTimeStyle

      protected org.apache.poi.ss.usermodel.CellStyle cellDateTimeStyle
    • boldCellDateTimeStyle

      protected org.apache.poi.ss.usermodel.CellStyle boldCellDateTimeStyle
    • cellDateStyle

      protected org.apache.poi.ss.usermodel.CellStyle cellDateStyle
    • boldCellDateStyle

      protected org.apache.poi.ss.usermodel.CellStyle boldCellDateStyle
    • cellTimeStyle

      protected org.apache.poi.ss.usermodel.CellStyle cellTimeStyle
    • boldCellTimeStyle

      protected org.apache.poi.ss.usermodel.CellStyle boldCellTimeStyle
    • cellIntegerStyle

      protected org.apache.poi.ss.usermodel.CellStyle cellIntegerStyle
    • boldCellIntegerStyle

      protected org.apache.poi.ss.usermodel.CellStyle boldCellIntegerStyle
    • cellDoubleStyle

      protected org.apache.poi.ss.usermodel.CellStyle cellDoubleStyle
    • boldCellDoubleStyle

      protected org.apache.poi.ss.usermodel.CellStyle boldCellDoubleStyle
    • fileName

      protected String fileName
    • entityMetaClass

      protected MetaClass entityMetaClass
    • messages

      protected Messages messages
    • downloader

      protected Downloader downloader
    • dateTimeParseFormat

      protected String dateTimeParseFormat
    • dateTimeFormatter

      protected SimpleDateFormat dateTimeFormatter
    • dateParseFormat

      protected String dateParseFormat
    • dateFormatter

      protected SimpleDateFormat dateFormatter
    • timeParseFormat

      protected String timeParseFormat
    • timeFormatter

      protected SimpleDateFormat timeFormatter
    • notifications

      protected Notifications notifications
    • coreProperties

      @Autowired protected CoreProperties coreProperties
    • uiProperties

      @Autowired protected UiProperties uiProperties
    • messageTools

      @Autowired protected MessageTools messageTools
    • datatypeRegistry

      @Autowired protected DatatypeRegistry datatypeRegistry
    • currentAuthentication

      @Autowired protected CurrentAuthentication currentAuthentication
  • Constructor Details

    • PivotExcelExporter

      public PivotExcelExporter(PivotTable pivotTable)
    • PivotExcelExporter

      public PivotExcelExporter()
  • Method Details

    • init

      public void init(PivotTable pivotTable)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setDownloader

      @Autowired public void setDownloader(Downloader downloader)
    • initNotifications

      protected void initNotifications(PivotTable pivotTable)
    • exportPivotTable

      public void exportPivotTable(PivotData pivotData, String fileName)
      Exports pivot table data to the excel file. File format can be configured by setExportFormat(ExportFormat).
      Parameters:
      pivotData - pivot with aggregated data
      fileName - file name
    • exportPivotTable

      public void exportPivotTable(PivotData pivotData, String fileName, Downloader downloader)
      Exports pivot table data to the excel file. File format can be configured by setExportFormat(ExportFormat).
      Parameters:
      pivotData - pivot with aggregated data
      fileName - file name
      downloader - Downloader implementation
    • createRows

      protected void createRows(PivotData pivotData)
    • initCell

      protected void initCell(org.apache.poi.ss.usermodel.Cell excelCell, PivotDataSeparatedCell cell)
    • updateColumnSize

      protected void updateColumnSize(ExcelAutoColumnSizer[] sizers, PivotDataSeparatedCell cell)
    • initDateTimeCell

      protected void initDateTimeCell(org.apache.poi.ss.usermodel.Cell excelCell, PivotDataSeparatedCell cell, SimpleDateFormat formatter, org.apache.poi.ss.usermodel.CellStyle cellStyle, org.apache.poi.ss.usermodel.CellStyle boldCellStyle)
    • createWorkbookWithSheet

      protected void createWorkbookWithSheet()
    • createCellsStyle

      protected void createCellsStyle()
    • getBuiltinFormat

      protected short getBuiltinFormat(String format)
    • showWarnNotification

      protected void showWarnNotification()
    • export

      protected void export(Downloader downloader)
    • showNoDataWarning

      protected void showNoDataWarning()
    • isPivotDataEmpty

      protected boolean isPivotDataEmpty(PivotData pivotData)
    • isXlsMaxRowNumberExceeded

      public boolean isXlsMaxRowNumberExceeded(PivotData pivotData)
      Parameters:
      pivotData - pivot with aggregated data
      Returns:
      true if exported table contains more than 65536 records
    • getDateTimeParseFormat

      @Nullable public String getDateTimeParseFormat()
      Returns:
      dateTime format or null
    • setDateTimeParseFormat

      public void setDateTimeParseFormat(String dateTimeParseFormat)
      Sets dateTime format that will be used to finding dateTime value and exporting it to excel with dateTime type.
      Parameters:
      dateTimeParseFormat - dateTime format (e.g. dd/MM/yyyy HH:mm)
    • getDateParseFormat

      @Nullable public String getDateParseFormat()
      Returns:
      date format or null
    • setDateParseFormat

      public void setDateParseFormat(String dateParseFormat)
      Sets date format that will be used to finding dateTime value and exporting it to excel with date type. If there is no format set, date properties will be recognized as text value.
      Parameters:
      dateParseFormat - date format (e.g. dd/MM/yyyy)
    • getTimeParseFormat

      @Nullable public String getTimeParseFormat()
      Returns:
      time format or null
    • setTimeParseFormat

      public void setTimeParseFormat(String timeParseFormat)
      Sets date format that will be used to finding dateTime value and exporting it to excel with date type. If there is no format set, time properties will be recognized as text value.
      Parameters:
      timeParseFormat - time format (e.g. HH:mm)
    • getExportFormat

      public PivotExcelExporter.ExportFormat getExportFormat()
      Returns:
      export format XLS or XLSX
    • setExportFormat

      public void setExportFormat(PivotExcelExporter.ExportFormat exportFormat)
      Sets export format XLS or XLSX. The default value is XLSX.
      Parameters:
      exportFormat - format that should have exported file