Class ExcelExporter
java.lang.Object
io.jmix.gridexportui.exporter.AbstractTableExporter<ExcelExporter>
io.jmix.gridexportui.exporter.excel.ExcelExporter
- All Implemented Interfaces:
TableExporter
@Component("grdexp_ExcelExporter")
@Scope("prototype")
public class ExcelExporter
extends AbstractTableExporter<ExcelExporter>
Use this class to export
Just create an instance of
Table
into Excel format
Just create an instance of
ExportAction
with withExporter
method.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.gridexportui.exporter.TableExporter
TableExporter.ColumnValueContext
-
Field Summary
Modifier and TypeFieldDescriptionprotected AllRecordsExporter
protected 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 boolean
protected Boolean
protected GridExportProperties
protected org.apache.poi.ss.usermodel.CellStyle
protected boolean
static final int
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.gridexportui.exporter.AbstractTableExporter
columnValueProviders, coreProperties, datatypeRegistry, fileName, messages, messageTools, metadataTools, uiProperties
-
Constructor Summary
ConstructorDescriptionExcelExporter
(GridExportProperties gridExportProperties, AllRecordsExporter allRecordsExporter) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkIsRowNumberExceed
(int r) protected int
createAggregatableRow
(Table<Object> table, List<Table.Column<Object>> columns, int rowNumber, int aggregatableRow) protected void
createAutoColumnSizers
(int count) protected int
createDataGridHierarchicalRow
(TreeDataGrid dataGrid, TreeDataGridItems<Object> treeDataGridItems, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object item) protected void
createDataGridRow
(DataGrid dataGrid, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object itemId) protected void
createDataGridRowForEntityInstance
(DataGrid dataGrid, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object entityInstance, boolean addLevelPadding) protected void
protected void
protected int
createGroupRow
(GroupTable<Object> table, List<Table.Column<Object>> columns, int rowNumber, GroupInfo<?> groupInfo, int groupNumber) protected int
createHierarchicalRow
(TreeTable<Object> table, List<Table.Column<Object>> columns, Boolean exportExpanded, int rowNumber, Object itemId) protected Function<Object,
InstanceContainer<Object>> createInstanceContainerProvider
(DataGrid dataGrid, Object item) protected void
createRow
(Table<Object> table, List<Table.Column<Object>> columns, int startColumn, int rowNumber, Object itemId) protected void
createRowForEntityInstance
(Table<Object> table, List<Table.Column<Object>> columns, int startColumn, int rowNumber, Object entityInstance, boolean addLevelPadding) protected String
createSpaceString
(int level) protected void
protected void
void
exportDataGrid
(Downloader downloader, DataGrid<Object> dataGrid, ExportMode exportMode) downloaddataGrid
content viadownloader
void
exportTable
(Downloader downloader, Table<Object> table, ExportMode exportMode) downloadtable
content viadownloader
protected void
formatValueCell
(org.apache.poi.ss.usermodel.Cell cell, Object cellValue, MetaPropertyPath metaPropertyPath, int sizersIndex, int notificationRequired, int level, Integer groupChildCount) returns exporter captionboolean
protected boolean
hasAggregatableColumn
(Table<Object> table) Checks that at least one column in table is aggregatable.protected boolean
void
setExportAggregation
(boolean exportAggregation) Export table with aggregationvoid
setExportExpanded
(Boolean exportExpanded) Export tree table with expanded rowswithExportAggregation
(Boolean exportAggregation) Export table with aggregationwithExportExpanded
(Boolean exportExpanded) Export tree table with expanded rowsMethods inherited from class io.jmix.gridexportui.exporter.AbstractTableExporter
addColumnValueProvider, formatValue, formatValue, getColumnValue, getColumnValue, getColumnValueProvider, getFileName, getFileName, getFileName, getMetaClassName, removeColumnValueProvider, setFileName, 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
-
allRecordsExporter
-
-
Constructor Details
-
ExcelExporter
@Autowired public ExcelExporter(GridExportProperties gridExportProperties, AllRecordsExporter allRecordsExporter)
-
-
Method Details
-
createWorkbookWithSheet
protected void createWorkbookWithSheet() -
createFonts
protected void createFonts() -
createAutoColumnSizers
protected void createAutoColumnSizers(int count) -
exportTable
Description copied from interface:TableExporter
downloadtable
content viadownloader
-
exportDataGrid
Description copied from interface:TableExporter
downloaddataGrid
content viadownloader
-
createDataGridHierarchicalRow
protected int createDataGridHierarchicalRow(TreeDataGrid dataGrid, TreeDataGridItems<Object> treeDataGridItems, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object item) -
createDataGridRow
protected void createDataGridRow(DataGrid dataGrid, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object itemId) -
createDataGridRowForEntityInstance
protected void createDataGridRowForEntityInstance(DataGrid dataGrid, List<DataGrid.Column<Object>> columns, int startColumn, int rowNumber, Object entityInstance, boolean addLevelPadding) -
createInstanceContainerProvider
protected Function<Object,InstanceContainer<Object>> createInstanceContainerProvider(DataGrid dataGrid, Object item) - Overrides:
createInstanceContainerProvider
in classAbstractTableExporter<ExcelExporter>
-
createFormats
protected void createFormats() -
createHierarchicalRow
-
createAggregatableRow
protected int createAggregatableRow(Table<Object> table, List<Table.Column<Object>> columns, int rowNumber, int aggregatableRow) -
createGroupRow
protected int createGroupRow(GroupTable<Object> table, List<Table.Column<Object>> columns, int rowNumber, GroupInfo<?> groupInfo, int groupNumber) -
createRow
-
createRowForEntityInstance
-
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 65536 records
-
setExportAggregation
public void setExportAggregation(boolean exportAggregation) Export table with aggregation- Parameters:
exportAggregation
- set to true to export table with aggregation
-
getExportAggregation
public boolean getExportAggregation()- Returns:
- export aggregation
-
withExportAggregation
Export table with aggregation- Parameters:
exportAggregation
- set to true to export table with aggregation- Returns:
- exporter instance
-
hasAggregatableColumn
Checks that at least one column in table is aggregatable.- Parameters:
table
- table- Returns:
- true if at least one column is aggregatable
-
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
-
getCaption
Description copied from interface:TableExporter
returns exporter caption -
disposeWorkBook
protected void disposeWorkBook()
-