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
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected static final int
CAUTION Magic number! This multiplier is used for calculating column width.protected CoreProperties
protected CurrentAuthentication
protected DatatypeRegistry
protected SimpleDateFormat
protected String
protected SimpleDateFormat
protected String
static final String
protected Downloader
protected MetaClass
protected PivotTableExcelExporter.ExportFormat
protected String
static final int
protected Messages
protected MessageTools
protected Notifications
protected org.apache.poi.ss.usermodel.Sheet
protected org.apache.poi.ss.usermodel.Font
protected SimpleDateFormat
protected String
protected UiProperties
protected org.apache.poi.ss.usermodel.Workbook
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
createRows
(PivotData pivotData) protected void
protected void
export
(Downloader downloader) void
exportPivotTable
(PivotData pivotData, String fileName) Exports pivot table data to the Excel file.void
exportPivotTable
(PivotData pivotData, String fileName, Downloader downloader) Exports pivot table data to the Excel file.protected short
getBuiltinFormat
(String format) void
init
(PivotTable<?> pivotTable) protected void
initCell
(org.apache.poi.ss.usermodel.Cell excelCell, PivotDataSeparatedCell cell) 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) protected boolean
isPivotDataEmpty
(PivotData pivotData) boolean
isXlsMaxRowNumberExceeded
(PivotData pivotData) void
setDateParseFormat
(String dateParseFormat) Sets date format that will be used to finding dateTime value and exporting it to excel with date type.void
setDateTimeParseFormat
(String dateTimeParseFormat) Sets dateTime format that will be used to finding dateTime value and exporting it to excel with dateTime type.void
setDownloader
(Downloader downloader) void
setExportFormat
(PivotTableExcelExporter.ExportFormat exportFormat) Sets export formatXLS
orXLSX
.void
setMessages
(Messages messages) void
setTimeParseFormat
(String timeParseFormat) Sets date format that will be used to finding dateTime value and exporting it to excel with date type.protected void
protected void
protected void
updateColumnSize
(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
XLS
orXLSX
-
setExportFormat
Sets export formatXLS
orXLSX
. The default value isXLSX
.- Parameters:
exportFormat
- format that should have exported file
-