it.eng.spagobi.engines.qbe.crosstable.exporter
Class CrosstabXLSExporter

java.lang.Object
  extended by it.eng.spagobi.engines.qbe.crosstable.exporter.CrosstabXLSExporter

public class CrosstabXLSExporter
extends java.lang.Object

Exports the crosstab data (formatted as a JSON object in input) into a XLS file. The JSON object should have this structure (a node is {node_key:"Text", node_childs:[...]}): columns: {...} contains tree node structure of the columns' headers rows: {...} contains tree node structure of the rows' headers data: [[...], [...], ...] 2-dimensional matrix containing crosstab data

Author:
Davide Zerbetto (davide.zerbetto@eng.it)

Field Summary
static java.lang.String CROSSTAB_JSON_DESCENDANTS_NUMBER
           
static org.apache.log4j.Logger logger
          Logger component.
 
Constructor Summary
CrosstabXLSExporter()
           
 
Method Summary
 org.apache.poi.ss.usermodel.CellStyle buildDataCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 org.apache.poi.ss.usermodel.CellStyle buildHeaderCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 int commonFillSheet(org.apache.poi.ss.usermodel.Sheet sheet, org.json.JSONObject json, org.apache.poi.ss.usermodel.CreationHelper createHelper)
           
 org.apache.poi.ss.usermodel.Workbook export(org.json.JSONObject json)
          Exports the crosstab data (formatted as a JSON object in input) into a XLS file.
 int fillAlreadyCreatedSheet(org.apache.poi.ss.usermodel.Sheet sheet, org.json.JSONObject json, org.apache.poi.ss.usermodel.CreationHelper createHelper)
           
 void fillSheet(org.apache.poi.ss.usermodel.Sheet sheet, org.json.JSONObject json, org.apache.poi.ss.usermodel.CreationHelper createHelper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static transient org.apache.log4j.Logger logger
Logger component.


CROSSTAB_JSON_DESCENDANTS_NUMBER

public static final java.lang.String CROSSTAB_JSON_DESCENDANTS_NUMBER
See Also:
Constant Field Values
Constructor Detail

CrosstabXLSExporter

public CrosstabXLSExporter()
Method Detail

export

public org.apache.poi.ss.usermodel.Workbook export(org.json.JSONObject json)
                                            throws org.json.JSONException
Exports the crosstab data (formatted as a JSON object in input) into a XLS file. The JSON object should have this structure (a node is {node_key:"Text", node_childs:[...]}): columns: {...} contains tree node structure of the columns' headers rows: {...} contains tree node structure of the rows' headers data: [[...], [...], ...] 2-dimensional matrix containing crosstab data

Parameters:
json - The crosstab data serialization
Returns:
the Workbook object (the XLS file)
Throws:
org.json.JSONException

fillSheet

public void fillSheet(org.apache.poi.ss.usermodel.Sheet sheet,
                      org.json.JSONObject json,
                      org.apache.poi.ss.usermodel.CreationHelper createHelper)
               throws org.json.JSONException
Throws:
org.json.JSONException

fillAlreadyCreatedSheet

public int fillAlreadyCreatedSheet(org.apache.poi.ss.usermodel.Sheet sheet,
                                   org.json.JSONObject json,
                                   org.apache.poi.ss.usermodel.CreationHelper createHelper)
                            throws org.json.JSONException
Throws:
org.json.JSONException

commonFillSheet

public int commonFillSheet(org.apache.poi.ss.usermodel.Sheet sheet,
                           org.json.JSONObject json,
                           org.apache.poi.ss.usermodel.CreationHelper createHelper)
                    throws org.json.JSONException
Throws:
org.json.JSONException

buildHeaderCellStyle

public org.apache.poi.ss.usermodel.CellStyle buildHeaderCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)

buildDataCellStyle

public org.apache.poi.ss.usermodel.CellStyle buildDataCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)