JIDE 3.5.15

com.jidesoft.hssf
Class HssfPivotTableUtils

java.lang.Object
  extended by com.jidesoft.hssf.HssfTableUtils
      extended by com.jidesoft.hssf.HssfPivotTableUtils

public class HssfPivotTableUtils
extends HssfTableUtils

HssfPivotTableUtils is a class that has methods to export PivotTablePane to Excel file format using POI and keep the pivot table layout.

Please set the client property HssfTableUtils.CLIENT_PROPERTY_EXCEL_OUTPUT_FORMAT for the target PivotTablePane before you invoke this method so that you can choose the output format. If you didn't set the client property, we will use office2003 format for backward compatibility concern.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.hssf.HssfTableUtils
HssfTableUtils.CellValueConverter, HssfTableUtils.ContextSensitiveCellValueConverter, HssfTableUtils.DefaultCellValueConverter, HssfTableUtils.POICustomizer
 
Field Summary
 
Fields inherited from class com.jidesoft.hssf.HssfTableUtils
CLIENT_PROPERTY_EXCEL_OUTPUT_FORMAT, CLIENT_PROPERTY_FLUSH_ROWS, CLIENT_PROPERTY_USE_SXSSF_WORKBOOK, EXCEL_OUTPUT_FORMAT_2003, EXCEL_OUTPUT_FORMAT_2007
 
Constructor Summary
HssfPivotTableUtils()
           
 
Method Summary
static boolean export(PivotTablePane pane, OutputStream out, String sheetName)
          Exports the pivot table to Excel file as an output steam.
static boolean export(PivotTablePane pane, OutputStream out, String sheetName, HssfTableUtils.CellValueConverter converter)
          Exports the pivot table to Excel file.
static boolean export(PivotTablePane pane, OutputStream out, String sheetName, HssfTableUtils.CellValueConverter converter, boolean freezePanes)
          Exports the pivot table to Excel file.
static boolean export(PivotTablePane pane, String fileName, String sheetName, boolean append)
          Exports the pivot table to Excel file.
static boolean export(PivotTablePane pane, String fileName, String sheetName, boolean append, HssfTableFormat format)
          Exports the pivot table to Excel file.
static boolean export(PivotTablePane pane, String fileName, String sheetName, boolean append, HssfTableUtils.CellValueConverter converter)
          Exports the pivot table to Excel file.
static boolean export(PivotTablePane pane, String fileName, String sheetName, boolean append, HssfTableUtils.CellValueConverter converter, boolean freezePanes)
          Exports the pivot table to Excel file.
static void exportToWorkbook(Workbook wb, String sheetName, PivotTablePane pane, HssfTableFormat format)
          Export the PivotTablePane to a Workbook.
 
Methods inherited from class com.jidesoft.hssf.HssfTableUtils
export, export, export, export, export, export, export, export, export, export, export, export, exportToCell, exportToSheet, exportToSheet, exportToSheet, exportToSheet, exportToSheet, exportToSheet, exportToSheet, exportToSheet, isHssfInstalled, isXssfInstalled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HssfPivotTableUtils

public HssfPivotTableUtils()
Method Detail

export

public static boolean export(PivotTablePane pane,
                             String fileName,
                             String sheetName,
                             boolean append)
                      throws IOException
Exports the pivot table to Excel file.

Parameters:
pane - the PivotTablePane.
fileName - the Excel file name. It should be the full path to the file.
sheetName - the worksheet name.
append - whether it appends to the existing Excel file or it creates a new Excel file.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the file.

export

public static boolean export(PivotTablePane pane,
                             String fileName,
                             String sheetName,
                             boolean append,
                             HssfTableUtils.CellValueConverter converter)
                      throws IOException
Exports the pivot table to Excel file.

Parameters:
pane - the PivotTablePane.
fileName - the Excel file name. It should be the full path to the file.
sheetName - the worksheet name.
append - whether it appends to the existing Excel file or it creates a new Excel file.
converter - the converter to converts cell value to the value that can be set to Excel cell. Please note, this converter is only used to convert the cell in the data area, not any cells in row header or column header area.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the file.

export

public static boolean export(PivotTablePane pane,
                             String fileName,
                             String sheetName,
                             boolean append,
                             HssfTableUtils.CellValueConverter converter,
                             boolean freezePanes)
                      throws IOException
Exports the pivot table to Excel file.

Parameters:
pane - the PivotTablePane.
fileName - the Excel file name. It should be the full path to the file.
sheetName - the worksheet name.
append - whether it appends to the existing Excel file or it creates a new Excel file.
converter - the converter to converts cell value to the value that can be set to Excel cell. Please note, this converter is only used to convert the cell in the data area, not any cells in row header or column header area.
freezePanes - true to freeze the header areas. It means the header areas will stay when scroll horizontally and vertically.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the file.

export

public static boolean export(PivotTablePane pane,
                             String fileName,
                             String sheetName,
                             boolean append,
                             HssfTableFormat format)
                      throws IOException
Exports the pivot table to Excel file.

Parameters:
pane - the PivotTablePane.
fileName - the Excel file name. It should be the full path to the file.
sheetName - the worksheet name.
append - whether it appends to the existing Excel file or it creates a new Excel file.
format - HssfTableFormat instance which stores every single information needed for exporting to sheet.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the file.

export

public static boolean export(PivotTablePane pane,
                             OutputStream out,
                             String sheetName)
                      throws IOException
Exports the pivot table to Excel file as an output steam.

Parameters:
pane - the PivotTablePane.
out - the output stream
sheetName - the worksheet name.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the OutputStream.

export

public static boolean export(PivotTablePane pane,
                             OutputStream out,
                             String sheetName,
                             HssfTableUtils.CellValueConverter converter)
                      throws IOException
Exports the pivot table to Excel file.

Parameters:
pane - the PivotTablePane.
out - the output stream
sheetName - the worksheet name.
converter - the converter to converts cell value to the value that can be set to Excel cell.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the OutputStream.

export

public static boolean export(PivotTablePane pane,
                             OutputStream out,
                             String sheetName,
                             HssfTableUtils.CellValueConverter converter,
                             boolean freezePanes)
                      throws IOException
Exports the pivot table to Excel file.

Parameters:
pane - the PivotTablePane.
out - the output stream
sheetName - the worksheet name.
converter - the converter to converts cell value to the value that can be set to Excel cell.
freezePanes - true to freeze the header areas. It means the header areas will stay when scroll horizontally and vertically.
Returns:
true if exporting succeed. If poi.jar is not in the classpath, false will be returned. Exception will be thrown if there is error during the exporting.
Throws:
IOException - if if an I/O error occurs when writing to the OutputStream.

exportToWorkbook

public static void exportToWorkbook(Workbook wb,
                                    String sheetName,
                                    PivotTablePane pane,
                                    HssfTableFormat format)
Export the PivotTablePane to a Workbook.

Parameters:
wb - the Workbook instance
sheetName - the sheet name
pane - the PivotTablePane to be exported
format - the format to define how the PivotTablePane should be exported

JIDE 3.5.15