Package io.jmix.pivottableflowui.export
Class PivotTableExcelExporter
java.lang.Object
io.jmix.pivottableflowui.export.PivotTableExcelExporter
@Component("pvttbl_PivotTableExcelExporter")
@Scope("prototype")
public class PivotTableExcelExporter
extends Object
Exports
PivotData to XLS file.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected org.apache.poi.ss.usermodel.CellStyleprotected static final intCAUTION Magic number! This multiplier is used for calculating column width.protected CorePropertiesprotected CurrentAuthenticationprotected DatatypeRegistryprotected SimpleDateFormatprotected Stringprotected SimpleDateFormatprotected Stringstatic final Stringprotected Downloaderprotected MetaClassprotected PivotTableExcelExporter.ExportFormatprotected Stringstatic final intprotected Messagesprotected MessageToolsprotected Notificationsprotected org.apache.poi.ss.usermodel.Sheetprotected org.apache.poi.ss.usermodel.Fontprotected SimpleDateFormatprotected Stringprotected UiPropertiesprotected org.apache.poi.ss.usermodel.Workbook -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcreateRows(PivotData pivotData) protected voidprotected voidexport(Downloader downloader) voidexportPivotTable(PivotData pivotData, String fileName) Exports pivot table data to the Excel file.voidexportPivotTable(PivotData pivotData, String fileName, Downloader downloader) Exports pivot table data to the Excel file.protected shortgetBuiltinFormat(String format) voidinit(PivotTable<?> pivotTable) protected voidinitCell(org.apache.poi.ss.usermodel.Cell excelCell, PivotDataSeparatedCell cell) protected voidinitDateTimeCell(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) protected booleanisPivotDataEmpty(PivotData pivotData) booleanisXlsMaxRowNumberExceeded(PivotData pivotData) voidsetDateParseFormat(String dateParseFormat) Sets date format that will be used to finding dateTime value and exporting it to excel with date type.voidsetDateTimeParseFormat(String dateTimeParseFormat) Sets dateTime format that will be used to finding dateTime value and exporting it to excel with dateTime type.voidsetDownloader(Downloader downloader) voidsetExportFormat(PivotTableExcelExporter.ExportFormat exportFormat) Sets export formatXLSorXLSX.voidsetMessages(Messages messages) voidsetTimeParseFormat(String timeParseFormat) Sets date format that will be used to finding dateTime value and exporting it to excel with date type.protected voidprotected voidprotected voidupdateColumnSize(ExcelAutoColumnSizer[] sizers, PivotDataSeparatedCell cell)
-
Field Details
-
MAX_ROW_INDEX
public static final int MAX_ROW_INDEX- See Also:
-
COLUMN_WIDTH_MULTIPLIER
protected static final int COLUMN_WIDTH_MULTIPLIERCAUTION 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
- See Also:
-
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
-
entityMetaClass
-
messages
-
downloader
-
dateTimeParseFormat
-
dateTimeFormatter
-
dateParseFormat
-
dateFormatter
-
timeParseFormat
-
timeFormatter
-
notifications
-
coreProperties
-
uiProperties
-
messageTools
-
datatypeRegistry
-
currentAuthentication
-
-
Constructor Details
-
PivotTableExcelExporter
public PivotTableExcelExporter() -
PivotTableExcelExporter
-
-
Method Details
-
setMessages
-
setDownloader
-
init
-
exportPivotTable
Exports pivot table data to the Excel file. File format can be configured bysetExportFormat(ExportFormat).- Parameters:
pivotData- pivot with aggregated datafileName- file name
-
exportPivotTable
Exports pivot table data to the Excel file. File format can be configured bysetExportFormat(ExportFormat).- Parameters:
pivotData- pivot with aggregated datafileName- file namedownloader- Downloader implementation
-
createRows
-
initCell
-
updateColumnSize
-
initDateTimeCell
protected void initDateTimeCell(org.apache.poi.ss.usermodel.Cell excelCell, PivotDataSeparatedCell cell, @Nullable 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
-
showWarnNotification
protected void showWarnNotification() -
export
-
showNoDataWarning
protected void showNoDataWarning() -
isPivotDataEmpty
-
isXlsMaxRowNumberExceeded
- Parameters:
pivotData- pivot with aggregated data- Returns:
- true if exported table contains more than 65536 records
-
getDateTimeParseFormat
- Returns:
- dateTime format or null
-
setDateTimeParseFormat
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
- Returns:
- date format or null
-
setDateParseFormat
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
- Returns:
- time format or null
-
setTimeParseFormat
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
- Returns:
- export format
XLSorXLSX
-
setExportFormat
Sets export formatXLSorXLSX. The default value isXLSX.- Parameters:
exportFormat- format that should have exported file
-