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

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

public class CrosstabXLSXExporterFromJavaObject
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:
Alberto Ghedin (alberto.ghedin@eng.it), Davide Zerbetto (davide.zerbetto@eng.it)

Field Summary
static org.apache.log4j.Logger logger
          Logger component.
 
Constructor Summary
CrosstabXLSXExporterFromJavaObject()
           
 
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, CrossTab cs, org.json.JSONObject crosstabJSON, org.apache.poi.ss.usermodel.CreationHelper createHelper, int startRow)
           
 int fillAlreadyCreatedSheet(org.apache.poi.ss.usermodel.Sheet sheet, CrossTab cs, org.json.JSONObject crosstabJSON, org.apache.poi.ss.usermodel.CreationHelper createHelper, int startRow)
           
 int initSheet(org.apache.poi.ss.usermodel.Sheet sheet, CrossTab cs)
          Sheet initialization.
 
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.

Constructor Detail

CrosstabXLSXExporterFromJavaObject

public CrosstabXLSXExporterFromJavaObject()
Method Detail

fillAlreadyCreatedSheet

public int fillAlreadyCreatedSheet(org.apache.poi.ss.usermodel.Sheet sheet,
                                   CrossTab cs,
                                   org.json.JSONObject crosstabJSON,
                                   org.apache.poi.ss.usermodel.CreationHelper createHelper,
                                   int startRow)
                            throws org.json.JSONException,
                                   it.eng.qbe.serializer.SerializationException
Throws:
org.json.JSONException
it.eng.qbe.serializer.SerializationException

commonFillSheet

public int commonFillSheet(org.apache.poi.ss.usermodel.Sheet sheet,
                           CrossTab cs,
                           org.json.JSONObject crosstabJSON,
                           org.apache.poi.ss.usermodel.CreationHelper createHelper,
                           int startRow)
                    throws it.eng.qbe.serializer.SerializationException,
                           org.json.JSONException
Throws:
it.eng.qbe.serializer.SerializationException
org.json.JSONException

initSheet

public int initSheet(org.apache.poi.ss.usermodel.Sheet sheet,
                     CrossTab cs)
              throws org.json.JSONException
Sheet initialization. We create as many rows as it is required to contain the crosstab.

Parameters:
sheet - The XLS sheet
json - The crosstab data (it must have been enriched with the calculateDescendants method)
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)