Package org.zkoss.pivot.util
Class Exports
- java.lang.Object
-
- org.zkoss.pivot.util.Exports
-
public class Exports extends Object
Utility class for PivotTable Exporter- Author:
- vincentjian, Neil Lee
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_FORMAT
Default file format for exporting to excel.static String
XLS
static String
XLSX
static String
XLSX_STATIC
-
Constructor Summary
Constructors Constructor Description Exports()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
exportCSV(OutputStream out, PivotExportContext context)
Export Pivottable to CSV format, with comma as separatorstatic void
exportCSV(OutputStream out, PivotExportContext context, String separator)
Export Pivottable to CSV format.static void
exportExcel(OutputStream out, String fileFormat, PivotExportContext context)
Export Pivottable to excel format.static void
exportExcel(OutputStream out, String fileFormat, PivotExportContext context, CellStyleConfigurator styleConfig)
Export Pivottable to excel format.static void
exportExcel(OutputStream out, PivotExportContext context)
Export Pivottable to default Excel 2007 formatstatic void
exportExcel(OutputStream out, org.zkoss.poi.ss.usermodel.Workbook book, PivotExportContext context)
Export Pivottable to excel format.static void
exportExcel(OutputStream out, org.zkoss.poi.ss.usermodel.Workbook book, PivotExportContext context, CellStyleConfigurator styleConfig)
Export Pivottable to excel format.static PivotExportContext
getExportContext(PivotModel model, PivotRenderer renderer, String dataFieldOrient, boolean open, String[] titles)
Return a context for exporting Pivottable informationstatic PivotExportContext
getExportContext(PivotModel model, PivotRenderer renderer, String dataFieldOrient, boolean open, String[] titles, boolean useRendererForDataCells)
static PivotExportContext
getExportContext(Pivottable table, boolean open, String[] titles)
Return a context for exporting Pivottable informationstatic PivotExportContext
getExportContext(Pivottable table, boolean open, String[] titles, boolean useRendererForDataCells)
static PivotExportContext
getExportContext(Pivottable table, boolean open, String[] titles, boolean useRendererForDataCells, PivotExportSheetConfig sheetConfig)
Return a context for exporting Pivottable information
-
-
-
Field Detail
-
XLSX
public static final String XLSX
- See Also:
- Constant Field Values
-
XLSX_STATIC
public static final String XLSX_STATIC
- See Also:
- Constant Field Values
-
XLS
public static final String XLS
- See Also:
- Constant Field Values
-
DEFAULT_FORMAT
public static final String DEFAULT_FORMAT
Default file format for exporting to excel. Use library property org.zkoss.pivot.export.format to specify different default.
-
-
Method Detail
-
exportExcel
public static void exportExcel(OutputStream out, PivotExportContext context) throws IOException
Export Pivottable to default Excel 2007 format- Parameters:
out
- the output stream to write tocontext
- the export context created from Pivottable or model- Throws:
IOException
- Since:
- 2.2.0
-
exportExcel
public static void exportExcel(OutputStream out, String fileFormat, PivotExportContext context) throws IOException
Export Pivottable to excel format. Note:- "xlsx" format creates a sheet with native Pivot Table (also contains a sheet with source data)
- "xlsx.static" format creates a sheet with
Pivottable
data. - "xls" format creates a sheet with
Pivottable
data.
- Parameters:
out
- the output stream to write tofileFormat
- "xls", "xlsx", or "xlsx.static" supported.context
- the export context created from Pivottable or model- Throws:
IOException
-
exportExcel
public static void exportExcel(OutputStream out, org.zkoss.poi.ss.usermodel.Workbook book, PivotExportContext context) throws IOException
Export Pivottable to excel format.Note the
XSSFWorkbook
workbook create sheet with native Pivot Table (also contains a sheet with source data),
theHSSFWorkbook
workbook create sheet withPivottable
data.- Parameters:
out
- the output stream to write tobook
- the workbook eitherHSSFWorkbook
orXSSFWorkbook
, if null will useHSSFWorkbook
.context
- the export context created from Pivottable or model- Throws:
IOException
- Since:
- 2.2.0
-
exportExcel
public static void exportExcel(OutputStream out, String fileFormat, PivotExportContext context, CellStyleConfigurator styleConfig) throws IOException
Export Pivottable to excel format.- "xlsx" format creates a sheet with native Pivot Table (also contains a sheet with source data)
- "xlsx.static" format creates a sheet with
Pivottable
data. - "xls" format creates a sheet with
Pivottable
data.
- Parameters:
out
- the output stream to write tofileFormat
- "xls", "xlsx", or "xlsx.static" supported.context
- the export context created from Pivottable or modelstyleConfig
- configurator for excel cell style- Throws:
IOException
-
exportExcel
public static void exportExcel(OutputStream out, org.zkoss.poi.ss.usermodel.Workbook book, PivotExportContext context, CellStyleConfigurator styleConfig) throws IOException
Export Pivottable to excel format.Note the
XSSFWorkbook
workbook create sheet with native Pivot Table (also contains a sheet with source data),
theHSSFWorkbook
workbook create sheet withPivottable
data.- Parameters:
out
- the output stream to write tobook
- the workbook eitherHSSFWorkbook
orXSSFWorkbook
, if null will useHSSFWorkbook
.context
- the export context created from Pivottable or modelstyleConfig
- configurator for excel cell style- Throws:
IOException
- Since:
- 2.2.0
-
exportCSV
public static void exportCSV(OutputStream out, PivotExportContext context) throws IOException
Export Pivottable to CSV format, with comma as separator- Parameters:
out
- the output stream to write tocontext
- the export context created from Pivottable or model- Throws:
IOException
-
exportCSV
public static void exportCSV(OutputStream out, PivotExportContext context, String separator) throws IOException
Export Pivottable to CSV format.- Parameters:
out
- the output stream to write tocontext
- the export context created from Pivottable or modelseparator
- the separator for marking cell boundary in CSV file- Throws:
IOException
-
getExportContext
public static PivotExportContext getExportContext(Pivottable table, boolean open, String[] titles)
Return a context for exporting Pivottable information- Parameters:
table
- the Pivottable instanceopen
- export as if all the header nodes were open (the model is not affected)titles
- title text for data, column, row title cells, respectively. i.e. titles[0] will be rendered to the data title cell, titles[1] to the column title cell, and titles[2] to the row title cell.
-
getExportContext
public static PivotExportContext getExportContext(Pivottable table, boolean open, String[] titles, boolean useRendererForDataCells)
-
getExportContext
public static PivotExportContext getExportContext(Pivottable table, boolean open, String[] titles, boolean useRendererForDataCells, PivotExportSheetConfig sheetConfig)
Return a context for exporting Pivottable information- Parameters:
table
- the Pivottable instanceopen
- export as if all the header nodes were open (the model is not affected)titles
- seegetExportContext(Pivottable, boolean, String[])
useRendererForDataCells
-sheetConfig
- aPivotExportSheetConfig
defining sheet names/order/visiblity- Since:
- 2.4.0
-
getExportContext
public static PivotExportContext getExportContext(PivotModel model, PivotRenderer renderer, String dataFieldOrient, boolean open, String[] titles)
Return a context for exporting Pivottable information- Parameters:
model
- the PivotModelrenderer
- the PivotRendererdataFieldOrient
- to arrange data fields on column or row, if there are multiple data fields. Accepted values are "column" and "row".open
- export as if all the header nodes were open (the model is not affected)titles
- title text for data, column, row title cells, respectively. i.e. titles[0] will be rendered to the data title cell, titles[1] to the column title cell, and titles[2] to the row title cell.
-
getExportContext
public static PivotExportContext getExportContext(PivotModel model, PivotRenderer renderer, String dataFieldOrient, boolean open, String[] titles, boolean useRendererForDataCells)
-
-