Class GridExporter<T>
- java.lang.Object
-
- com.flowingcode.vaadin.addons.gridexporter.GridExporter<T>
-
- All Implemented Interfaces:
java.io.Serializable
public class GridExporter<T> extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description int
totalcells
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> GridExporter<T>
createFor(com.vaadin.flow.component.grid.Grid<T> grid)
static <T> GridExporter<T>
createFor(com.vaadin.flow.component.grid.Grid<T> grid, java.lang.String excelCustomTemplate, java.lang.String docxCustomTemplate)
java.util.Map<java.lang.String,java.lang.String>
getAdditionalPlaceHolders()
com.vaadin.flow.server.StreamResource
getCsvStreamResource()
com.vaadin.flow.server.StreamResource
getDocxStreamResource()
com.vaadin.flow.server.StreamResource
getDocxStreamResource(java.lang.String template)
com.vaadin.flow.server.StreamResource
getExcelStreamResource()
com.vaadin.flow.server.StreamResource
getExcelStreamResource(java.lang.String template)
java.lang.String
getFileName()
com.vaadin.flow.server.StreamResource
getPdfStreamResource()
com.vaadin.flow.server.StreamResource
getPdfStreamResource(java.lang.String template)
int
getSheetNumber()
java.lang.String
getTitle()
boolean
isAutoAttachExportButtons()
boolean
isAutoMergeTitle()
boolean
isAutoSizeColumns()
boolean
isCsvExportEnabled()
boolean
isDocxExportEnabled()
boolean
isExcelExportEnabled()
boolean
isPdfExportEnabled()
void
setAdditionalPlaceHolders(java.util.Map<java.lang.String,java.lang.String> additionalPlaceHolders)
Sets a map that will contain additional place holders that will be replaced with values when processing the exported filevoid
setAutoAttachExportButtons(boolean autoAttachExportButtons)
If true, it will automatically generate export buttons in the asociated gridvoid
setAutoMergeTitle(boolean autoMergeTitle)
If true the title cell will be merged with the next ones to create a single title cell that will span across the columnsvoid
setAutoSizeColumns(boolean autoSizeColumns)
void
setCsvExportEnabled(boolean csvExportEnabled)
void
setDocxExportEnabled(boolean docxExportEnabled)
void
setExcelExportEnabled(boolean excelExportEnabled)
void
setExportColumn(com.vaadin.flow.component.grid.Grid.Column<T> column, boolean export)
Configure if the column is exported or notvoid
setExportValue(com.vaadin.flow.component.grid.Grid.Column<T> column, com.vaadin.flow.function.ValueProvider<T,java.lang.String> vp)
Configure a value provider for a given column.void
setFileName(java.lang.String fileName)
Sets the filename of the exported filevoid
setNullValueHandler(com.vaadin.flow.function.SerializableSupplier<java.lang.String> nullValueSupplier)
void
setPdfExportEnabled(boolean pdfExportEnabled)
void
setSheetNumber(int sheetNumber)
Configures the excel sheet that will be inspected for placeholders to export the datavoid
setTitle(java.lang.String title)
Sets the title of the exported file
-
-
-
Method Detail
-
createFor
public static <T> GridExporter<T> createFor(com.vaadin.flow.component.grid.Grid<T> grid)
-
createFor
public static <T> GridExporter<T> createFor(com.vaadin.flow.component.grid.Grid<T> grid, java.lang.String excelCustomTemplate, java.lang.String docxCustomTemplate)
-
getDocxStreamResource
public com.vaadin.flow.server.StreamResource getDocxStreamResource()
-
getDocxStreamResource
public com.vaadin.flow.server.StreamResource getDocxStreamResource(java.lang.String template)
-
getPdfStreamResource
public com.vaadin.flow.server.StreamResource getPdfStreamResource()
-
getPdfStreamResource
public com.vaadin.flow.server.StreamResource getPdfStreamResource(java.lang.String template)
-
getCsvStreamResource
public com.vaadin.flow.server.StreamResource getCsvStreamResource()
-
getExcelStreamResource
public com.vaadin.flow.server.StreamResource getExcelStreamResource()
-
getExcelStreamResource
public com.vaadin.flow.server.StreamResource getExcelStreamResource(java.lang.String template)
-
getTitle
public java.lang.String getTitle()
-
setTitle
public void setTitle(java.lang.String title)
Sets the title of the exported file- Parameters:
title
-
-
getFileName
public java.lang.String getFileName()
-
setFileName
public void setFileName(java.lang.String fileName)
Sets the filename of the exported file- Parameters:
fileName
-
-
isAutoAttachExportButtons
public boolean isAutoAttachExportButtons()
-
setAutoAttachExportButtons
public void setAutoAttachExportButtons(boolean autoAttachExportButtons)
If true, it will automatically generate export buttons in the asociated grid- Parameters:
autoAttachExportButtons
-
-
getAdditionalPlaceHolders
public java.util.Map<java.lang.String,java.lang.String> getAdditionalPlaceHolders()
-
setAdditionalPlaceHolders
public void setAdditionalPlaceHolders(java.util.Map<java.lang.String,java.lang.String> additionalPlaceHolders)
Sets a map that will contain additional place holders that will be replaced with values when processing the exported file- Parameters:
additionalPlaceHolders
-
-
getSheetNumber
public int getSheetNumber()
-
setSheetNumber
public void setSheetNumber(int sheetNumber)
Configures the excel sheet that will be inspected for placeholders to export the data- Parameters:
sheetNumber
-
-
isAutoMergeTitle
public boolean isAutoMergeTitle()
-
setAutoMergeTitle
public void setAutoMergeTitle(boolean autoMergeTitle)
If true the title cell will be merged with the next ones to create a single title cell that will span across the columns- Parameters:
autoMergeTitle
-
-
isExcelExportEnabled
public boolean isExcelExportEnabled()
-
setExcelExportEnabled
public void setExcelExportEnabled(boolean excelExportEnabled)
-
isDocxExportEnabled
public boolean isDocxExportEnabled()
-
setDocxExportEnabled
public void setDocxExportEnabled(boolean docxExportEnabled)
-
isPdfExportEnabled
public boolean isPdfExportEnabled()
-
setPdfExportEnabled
public void setPdfExportEnabled(boolean pdfExportEnabled)
-
isCsvExportEnabled
public boolean isCsvExportEnabled()
-
setCsvExportEnabled
public void setCsvExportEnabled(boolean csvExportEnabled)
-
isAutoSizeColumns
public boolean isAutoSizeColumns()
-
setAutoSizeColumns
public void setAutoSizeColumns(boolean autoSizeColumns)
-
setExportValue
public void setExportValue(com.vaadin.flow.component.grid.Grid.Column<T> column, com.vaadin.flow.function.ValueProvider<T,java.lang.String> vp)
Configure a value provider for a given column. If there is a value provider, that will be taken into account when exporting the column- Parameters:
column
-vp
-
-
setExportColumn
public void setExportColumn(com.vaadin.flow.component.grid.Grid.Column<T> column, boolean export)
Configure if the column is exported or not- Parameters:
column
-export
- : true will be included in the exported file, false will not be included
-
setNullValueHandler
public void setNullValueHandler(com.vaadin.flow.function.SerializableSupplier<java.lang.String> nullValueSupplier)
-
-