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
Just create an instance of
DataGrid
into Excel format.
Just create an instance of
ExportAction
with withExporter
method.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.gridexportflowui.exporter.DataGridExporter
DataGridExporter.ColumnValueContext
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.poi.ss.usermodel.Font
protected static final int
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.CellStyle
protected ExcelAllRecordsExporter
protected boolean
protected Boolean
protected GridExportProperties
protected org.apache.poi.ss.usermodel.CellStyle
protected boolean
static final int
protected Notifications
protected org.apache.poi.ss.usermodel.Sheet
protected ExcelAutoColumnSizer[]
protected org.apache.poi.ss.usermodel.Font
protected org.apache.poi.ss.usermodel.CellStyle
protected org.apache.poi.ss.usermodel.Workbook
Fields inherited from class io.jmix.gridexportflowui.exporter.AbstractDataGridExporter
columnValueProviders, coreProperties, datatypeRegistry, fileName, messages, messageTools, metadataTools, uiProperties
-
Constructor Summary
ConstructorDescriptionExcelExporter
(GridExportProperties gridExportProperties, ExcelAllRecordsExporter excelAllRecordsExporter, Notifications notifications) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkIsRowNumberExceed
(int r) protected void
createAutoColumnSizers
(int count) 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) 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) 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) protected void
protected void
protected Function<Object,
InstanceContainer<Object>> createInstanceContainerProvider
(com.vaadin.flow.component.grid.Grid<?> dataGrid, Object item) protected String
createSpaceString
(int level) protected void
protected void
void
exportDataGrid
(Downloader downloader, com.vaadin.flow.component.grid.Grid<Object> dataGrid, ExportMode exportMode) downloaddataGrid
content viadownloader
protected void
formatValueCell
(org.apache.poi.ss.usermodel.Cell cell, Object cellValue, MetaPropertyPath metaPropertyPath, int sizersIndex, int notificationRequired, int level, Integer groupChildCount) protected short
getBuiltinFormat
(String format) protected String
getColumnHeaderText
(com.vaadin.flow.component.grid.Grid.Column<?> column) boolean
getLabel()
protected String
getMessage
(String id) protected boolean
void
setExportAggregation
(boolean exportAggregation) Export table with aggregationvoid
setExportExpanded
(Boolean exportExpanded) Export tree table with expanded rowsprotected void
withExportAggregation
(Boolean exportAggregation) Export table with aggregationwithExportExpanded
(Boolean exportExpanded) Export tree table with expanded rowsMethods inherited from class io.jmix.gridexportflowui.exporter.AbstractDataGridExporter
addColumnValueProvider, formatValue, formatValue, getColumnValue, getColumnValueProvider, getFileName, getFileName, getMetaClassName, removeColumnValueProvider, setCoreProperties, setDatatypeRegistry, setFileName, setMessages, setMessageTools, setMetadataTools, setUiProperties, withFileName
-
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
-
exportAggregation
protected boolean exportAggregation -
exportExpanded
-
isRowNumberExceeded
protected boolean isRowNumberExceeded -
gridExportProperties
-
excelAllRecordsExporter
-
notifications
-
-
Constructor Details
-
ExcelExporter
public ExcelExporter(GridExportProperties gridExportProperties, ExcelAllRecordsExporter excelAllRecordsExporter, Notifications notifications)
-
-
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
downloaddataGrid
content viadownloader
-
getColumnHeaderText
-
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
-
createDataGridRowForEntityInstance
-
createInstanceContainerProvider
protected Function<Object,InstanceContainer<Object>> createInstanceContainerProvider(com.vaadin.flow.component.grid.Grid<?> dataGrid, Object item) - Overrides:
createInstanceContainerProvider
in classAbstractDataGridExporter<ExcelExporter>
-
createFormats
protected void createFormats() -
getBuiltinFormat
-
getMessage
-
createSpaceString
-
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
Export table with aggregation- Parameters:
exportAggregation
- set to true to export table with aggregation- Returns:
- exporter instance
-
getExportExpanded
- Returns:
- tree table export expanded
-
setExportExpanded
Export tree table with expanded rows- Parameters:
exportExpanded
- set to true to export collapsed items in expanded view
-
withExportExpanded
Export tree table with expanded rows- Parameters:
exportExpanded
- set to true to export collapsed items in expanded view- Returns:
- exporter instance
-
getLabel
- Returns:
- exporter label
-
disposeWorkBook
protected void disposeWorkBook()
-