org.zkoss.pivot.util
Class Exports

java.lang.Object
  extended by org.zkoss.pivot.util.Exports

public class Exports
extends java.lang.Object

Utility class for PivotTable Exporter

Author:
vincentjian

Nested Class Summary
static class Exports.PivotExportCell
          The cell unit for exporting to sheet-based format.
static interface Exports.PivotExportContext
          A context object containing information required for exporting to other files
 
Constructor Summary
Exports()
           
 
Method Summary
static void exportCSV(java.io.OutputStream out, Exports.PivotExportContext context)
          Export Pivottable to CSV format, with comma as separator
static void exportCSV(java.io.OutputStream out, Exports.PivotExportContext context, java.lang.String separator)
          Export Pivottable to CSV format.
static void exportExcel(java.io.OutputStream out, java.lang.String fileFormat, Exports.PivotExportContext context)
          Export Pivottable to excel format.
static void exportExcel(java.io.OutputStream out, java.lang.String fileFormat, Exports.PivotExportContext context, CellStyleConfigurator styleConfig)
          Export Pivottable to excel format.
static Exports.PivotExportContext getExportContext(PivotModel model, PivotRenderer renderer, java.lang.String dataFieldOrient, boolean open, java.lang.String[] titles)
          Return a context for exporting Pivottable information
static Exports.PivotExportContext getExportContext(Pivottable table, boolean open, java.lang.String[] titles)
          Return a context for exporting Pivottable information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exports

public Exports()
Method Detail

exportExcel

public static void exportExcel(java.io.OutputStream out,
                               java.lang.String fileFormat,
                               Exports.PivotExportContext context)
                        throws java.io.IOException
Export Pivottable to excel format.

Parameters:
out - the output stream to write to
fileFormat - currently only "xls" is supported.
context - the export context created from Pivottable or model
Throws:
java.io.IOException

exportExcel

public static void exportExcel(java.io.OutputStream out,
                               java.lang.String fileFormat,
                               Exports.PivotExportContext context,
                               CellStyleConfigurator styleConfig)
                        throws java.io.IOException
Export Pivottable to excel format.

Note the "xlsx" format create sheet with native Pivot Table (also contains a sheet with source data),
the "xls" formate create sheet with Pivottable data.

Parameters:
out - the output stream to write to
fileFormat - "xls" or "xlsx" supported.
context - the export context created from Pivottable or model
styleConfig - configurator for excel cell style
Throws:
java.io.IOException

exportCSV

public static void exportCSV(java.io.OutputStream out,
                             Exports.PivotExportContext context)
                      throws java.io.IOException
Export Pivottable to CSV format, with comma as separator

Parameters:
out - the output stream to write to
context - the export context created from Pivottable or model
Throws:
java.io.IOException

exportCSV

public static void exportCSV(java.io.OutputStream out,
                             Exports.PivotExportContext context,
                             java.lang.String separator)
                      throws java.io.IOException
Export Pivottable to CSV format.

Parameters:
out - the output stream to write to
context - the export context created from Pivottable or model
separator - the separator for marking cell boundary in CSV file
Throws:
java.io.IOException

getExportContext

public static Exports.PivotExportContext getExportContext(Pivottable table,
                                                          boolean open,
                                                          java.lang.String[] titles)
Return a context for exporting Pivottable information

Parameters:
table - the Pivottable instance
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 Exports.PivotExportContext getExportContext(PivotModel model,
                                                          PivotRenderer renderer,
                                                          java.lang.String dataFieldOrient,
                                                          boolean open,
                                                          java.lang.String[] titles)
Return a context for exporting Pivottable information

Parameters:
model - the PivotModel
renderer - the PivotRenderer
dataFieldOrient - 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.


Copyright © 2013. All Rights Reserved.