it.eng.spagobi.engines.qbe.crosstable.exporter
Class CrosstabXLSExporter
java.lang.Object
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 org.apache.log4j.Logger |
logger
Logger component. |
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,
int startRow)
|
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,
int startRow)
|
void |
fillSheet(org.apache.poi.ss.usermodel.Sheet sheet,
org.json.JSONObject json,
org.apache.poi.ss.usermodel.CreationHelper createHelper)
|
int |
initSheet(org.apache.poi.ss.usermodel.Sheet sheet,
org.json.JSONObject json)
Sheet initialization. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
public static transient org.apache.log4j.Logger logger
- Logger component.
CrosstabXLSExporter
public CrosstabXLSExporter()
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,
int startRow)
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,
int startRow)
throws org.json.JSONException
- Throws:
org.json.JSONException
initSheet
public int initSheet(org.apache.poi.ss.usermodel.Sheet sheet,
org.json.JSONObject json)
throws org.json.JSONException
- Sheet initialization. We create as many rows as it is required to contain the crosstab.
- Parameters:
sheet
- The XLS sheetjson
- 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)