Class DataTableExcelExporter
- java.lang.Object
-
- 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 StringDEFAULT_FONTprotected org.apache.poi.ss.usermodel.Workbookwb
-
Constructor Summary
Constructors Constructor Description DataTableExcelExporter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddColumnFacets(DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)protected booleanaddColumnGroup(DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)protected voidaddColumnValue(org.apache.poi.ss.usermodel.Row row, int col, String text)protected voidaddColumnValue(org.apache.poi.ss.usermodel.Row row, String value)protected voidaddColumnValue(org.apache.poi.ss.usermodel.Row row, javax.faces.component.UIComponent component)protected voidaddColumnValue(DataTable table, org.apache.poi.ss.usermodel.Row row, List<javax.faces.component.UIComponent> components, UIColumn column)protected voidaddTableFacets(javax.faces.context.FacesContext context, DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, DataTableExporter.ColumnType columnType)protected voidapplyCellOptions(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options, org.apache.poi.ss.usermodel.CellStyle cellStyle)protected org.apache.poi.ss.usermodel.CellapplyColumnAlignments(UIColumn column, org.apache.poi.ss.usermodel.Cell cell)protected voidapplyFacetOptions(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options, org.apache.poi.ss.usermodel.CellStyle facetStyle)protected voidapplyOptions(org.apache.poi.ss.usermodel.Workbook wb, DataTable table, org.apache.poi.ss.usermodel.Sheet sheet, ExporterOptions options)protected intcalculateColumnOffset(org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)protected org.apache.poi.ss.usermodel.RichTextStringcreateRichTextString(String value)protected org.apache.poi.ss.usermodel.SheetcreateSheet(org.apache.poi.ss.usermodel.Workbook wb, String sheetName, ExcelOptions options)protected org.apache.poi.ss.usermodel.WorkbookcreateWorkBook()voiddoExport(javax.faces.context.FacesContext context, DataTable table, ExportConfiguration exportConfiguration, int index)Export datatableprotected voidexportCells(DataTable table, Object document)voidexportTable(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, org.apache.poi.ss.usermodel.Sheet sheet, ExportConfiguration exportConfiguration)StringgetContentType()Content-type (MIME-type) excluding charset.StringgetFileExtension()File-extension of the exported file including a leading dot.org.apache.poi.ss.usermodel.FontgetFont(org.apache.poi.ss.usermodel.Workbook wb, ExporterOptions options)StringgetSheetName(javax.faces.context.FacesContext context, javax.faces.component.UIComponent table)protected org.apache.poi.ss.usermodel.WorkbookgetWorkBook()protected voidpostExport(javax.faces.context.FacesContext context, ExportConfiguration exportConfiguration)protected voidpreExport(javax.faces.context.FacesContext context, ExportConfiguration exportConfiguration)protected voidupdateCell(org.apache.poi.ss.usermodel.Cell cell, String value)If ExcelOptions.isStronglyTypedCells = true then for cells that are all numbers make them a numeric cell instead of a String cell.-
Methods inherited from class org.primefaces.component.datatable.export.DataTableExporter
export, exportAll, exportColumnByFunction, exportPageOnly, exportRow, exportRow, exportSelectionOnly, exportValue, getColumnsToExport, getOutputStream, hasColumnFooter, postRowExport, preRowExport
-
-
-
-
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:
preExportin classDataTableExporter- Throws:
IOException
-
doExport
public void doExport(javax.faces.context.FacesContext context, DataTable table, ExportConfiguration exportConfiguration, int index) throws IOExceptionDescription copied from class:DataTableExporterExport datatable- Specified by:
doExportin 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:
postExportin classDataTableExporter- Throws:
IOException
-
exportCells
protected void exportCells(DataTable table, Object document)
- Specified by:
exportCellsin 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 that are all numbers make them a numeric cell instead of a 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 interface:ExporterContent-type (MIME-type) excluding charset. (eg 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
-
getFileExtension
public String getFileExtension()
Description copied from interface:ExporterFile-extension of the exported file including a leading dot. (eg '.xlsx')
-
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)
-
-