Class DataTableExcelExporter
- java.lang.Object
-
- org.primefaces.component.export.Exporter<T>
-
- org.primefaces.component.export.TableExporter<DataTable>
-
- org.primefaces.component.datatable.export.DataTableExporter
-
- org.primefaces.component.datatable.export.DataTableExcelExporter
-
- Direct Known Subclasses:
DataTableExcelXExporter
public class DataTableExcelExporter extends DataTableExporter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.primefaces.component.datatable.export.DataTableExporter
DataTableExporter.ColumnType
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_FONT
protected org.apache.poi.ss.usermodel.Workbook
wb
-
Constructor Summary
Constructors Constructor Description DataTableExcelExporter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addColumnFacets(DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)
protected boolean
addColumnGroup(DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)
protected void
addColumnValue(org.apache.poi.ss.usermodel.Row row, int col, String text)
protected void
addColumnValue(org.apache.poi.ss.usermodel.Row row, String value)
protected void
addColumnValue(org.apache.poi.ss.usermodel.Row row, javax.faces.component.UIComponent component)
protected void
addColumnValue(DataTable table, org.apache.poi.ss.usermodel.Row row, List<javax.faces.component.UIComponent> components, UIColumn column)
protected void
addTableFacets(javax.faces.context.FacesContext context, DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)
protected void
applyCellOptions(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options, org.apache.poi.ss.usermodel.CellStyle cellStyle)
protected org.apache.poi.ss.usermodel.Cell
applyColumnAlignments(UIColumn column, org.apache.poi.ss.usermodel.Cell cell)
protected void
applyFacetOptions(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options, org.apache.poi.ss.usermodel.CellStyle facetStyle)
protected void
applyOptions(org.apache.poi.ss.usermodel.Workbook wb, DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, ExporterOptions options)
protected int
calculateColumnOffset(org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
protected org.apache.poi.ss.usermodel.RichTextString
createRichTextString(String value)
protected org.apache.poi.ss.usermodel.Sheet
createSheet(org.apache.poi.ss.usermodel.Workbook wb, String sheetName, ExcelOptions options)
protected org.apache.poi.ss.usermodel.Workbook
createWorkBook()
void
doExport(javax.faces.context.FacesContext context, DataTable table, ExportConfiguration exportConfiguration, int index)
Export datatableprotected void
exportCells(DataTable table, Object document)
void
exportTable(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, org.apache.poi.ss.usermodel.Sheet sheet, ExportConfiguration exportConfiguration)
String
getContentType()
Content-type (MIME-type) excluding charset.String
getFileExtension()
File-extension of the exported file including a leading dot.org.apache.poi.ss.usermodel.Font
getFont(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options)
String
getSheetName(javax.faces.context.FacesContext context, javax.faces.component.UIComponent table)
protected org.apache.poi.ss.usermodel.Workbook
getWorkBook()
protected void
postExport(javax.faces.context.FacesContext context, ExportConfiguration exportConfiguration)
protected void
preExport(javax.faces.context.FacesContext context, ExportConfiguration exportConfiguration)
protected void
updateCell(org.apache.poi.ss.usermodel.Cell cell, String value)
If ExcelOptions.isStronglyTypedCells = true then for cells check:-
Methods inherited from class org.primefaces.component.datatable.export.DataTableExporter
export, exportAll, exportColumnByFunction, exportPageOnly, exportRow, exportRow, exportSelectionOnly, getOutputStream, hasColumnFooter, postRowExport, preRowExport
-
Methods inherited from class org.primefaces.component.export.TableExporter
exportColumn, getExportableColumns
-
Methods inherited from class org.primefaces.component.export.Exporter
exportValue
-
-
-
-
Field Detail
-
DEFAULT_FONT
protected static final String DEFAULT_FONT
- See Also:
- Constant Field Values
-
wb
protected org.apache.poi.ss.usermodel.Workbook wb
-
-
Method Detail
-
preExport
protected void preExport(javax.faces.context.FacesContext context, ExportConfiguration exportConfiguration) throws IOException
- Overrides:
preExport
in classDataTableExporter
- Throws:
IOException
-
doExport
public void doExport(javax.faces.context.FacesContext context, DataTable table, ExportConfiguration exportConfiguration, int index) throws IOException
Description copied from class:DataTableExporter
Export datatable- Specified by:
doExport
in classDataTableExporter
- Parameters:
context
- faces contexttable
- datatable to exportexportConfiguration
- export configurationindex
- datatable current index during export process- Throws:
IOException
-
postExport
protected void postExport(javax.faces.context.FacesContext context, ExportConfiguration exportConfiguration) throws IOException
- Overrides:
postExport
in classDataTableExporter
- Throws:
IOException
-
exportCells
protected void exportCells(DataTable table, Object document)
- Specified by:
exportCells
in classDataTableExporter
-
addColumnFacets
protected void addColumnFacets(DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)
-
addTableFacets
protected void addTableFacets(javax.faces.context.FacesContext context, DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)
-
addColumnValue
protected void addColumnValue(org.apache.poi.ss.usermodel.Row row, javax.faces.component.UIComponent component)
-
addColumnValue
protected void addColumnValue(org.apache.poi.ss.usermodel.Row row, String value)
-
addColumnValue
protected void addColumnValue(org.apache.poi.ss.usermodel.Row row, int col, String text)
-
addColumnValue
protected void addColumnValue(DataTable table, org.apache.poi.ss.usermodel.Row row, List<javax.faces.component.UIComponent> components, UIColumn column)
-
addColumnGroup
protected boolean addColumnGroup(DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)
-
calculateColumnOffset
protected int calculateColumnOffset(org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
-
updateCell
protected void updateCell(org.apache.poi.ss.usermodel.Cell cell, String value)
If ExcelOptions.isStronglyTypedCells = true then for cells check:Numeric - String that are all numbers make them a numeric cell Currency - Convert to currency cell so math can be done in Excel String - fallback to just a normal string cell
Possible future enhancement of Date cells as well.- Parameters:
cell
- the cell to operate onvalue
- the String value to put in the cell
-
createRichTextString
protected org.apache.poi.ss.usermodel.RichTextString createRichTextString(String value)
-
createWorkBook
protected org.apache.poi.ss.usermodel.Workbook createWorkBook()
-
getWorkBook
protected org.apache.poi.ss.usermodel.Workbook getWorkBook()
-
createSheet
protected org.apache.poi.ss.usermodel.Sheet createSheet(org.apache.poi.ss.usermodel.Workbook wb, String sheetName, ExcelOptions options)
-
getContentType
public String getContentType()
Description copied from class:Exporter
Content-type (MIME-type) excluding charset. (eg 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')- Specified by:
getContentType
in classExporter<DataTable>
-
getFileExtension
public String getFileExtension()
Description copied from class:Exporter
File-extension of the exported file including a leading dot. (eg '.xlsx')- Specified by:
getFileExtension
in classExporter<DataTable>
-
exportTable
public void exportTable(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, org.apache.poi.ss.usermodel.Sheet sheet, ExportConfiguration exportConfiguration)
-
applyOptions
protected void applyOptions(org.apache.poi.ss.usermodel.Workbook wb, DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, ExporterOptions options)
-
applyFacetOptions
protected void applyFacetOptions(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options, org.apache.poi.ss.usermodel.CellStyle facetStyle)
-
applyCellOptions
protected void applyCellOptions(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options, org.apache.poi.ss.usermodel.CellStyle cellStyle)
-
applyColumnAlignments
protected org.apache.poi.ss.usermodel.Cell applyColumnAlignments(UIColumn column, org.apache.poi.ss.usermodel.Cell cell)
-
getSheetName
public String getSheetName(javax.faces.context.FacesContext context, javax.faces.component.UIComponent table)
-
getFont
public org.apache.poi.ss.usermodel.Font getFont(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options)
-
-