it.eng.spagobi.engines.worksheet.exporter
Class WorkSheetXLSExporter

java.lang.Object
  extended by it.eng.spagobi.engines.worksheet.exporter.WorkSheetXLSExporter
Direct Known Subclasses:
WorkSheetXLSXExporter

public class WorkSheetXLSExporter
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:
Chiara Chiarelli

Field Summary
static java.lang.String CENTER
           
static java.lang.String CHART
           
static java.lang.String CONTENT
           
static java.lang.String CROSSTAB
           
static java.lang.String CROSSTAB_JSON_DESCENDANTS_NUMBER
           
static java.lang.String EXPORTED_SHEETS
           
static short FILTERS_TITLE_FONT_SIZE
           
static short FILTERS_VALUES_FONT_SIZE
           
static java.lang.String FONT_NAME
           
static java.lang.String FOOTER
           
static java.lang.String HEADER
           
static short HEADER_FONT_SIZE
           
static java.lang.String IMG
           
static java.lang.String LEFT
           
static org.apache.log4j.Logger logger
          Logger component.
static short METADATA_NAME_FONT_SIZE
           
static short METADATA_TITLE_FONT_SIZE
           
static short METADATA_VALUE_FONT_SIZE
           
static java.lang.String OUTPUT_FORMAT_JPEG
           
static java.lang.String POSITION
           
static java.lang.String RIGHT
           
static java.lang.String SHEET_TYPE
           
static java.lang.String SHEETS_NUM
           
static java.lang.String SVG
           
static java.lang.String TABLE
           
static short TABLE_CELL_CONTENT_FONT_SIZE
           
static short TABLE_HEADER_FONT_SIZE
           
static java.lang.String TITLE
           
 
Constructor Summary
WorkSheetXLSExporter()
           
 
Method Summary
 org.apache.poi.ss.usermodel.CellStyle buildFiltersTitleCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 org.apache.poi.ss.usermodel.CellStyle buildFiltersValuesCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 org.apache.poi.ss.usermodel.CellStyle buildHeaderTitleCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 org.apache.poi.ss.usermodel.CellStyle buildMetadataNameCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 org.apache.poi.ss.usermodel.CellStyle buildMetadataTitleCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
 org.apache.poi.ss.usermodel.CellStyle buildMetadataValueCellStyle(org.apache.poi.ss.usermodel.Sheet sheet)
           
static java.util.List<java.io.File> createJPGImage(org.json.JSONObject content)
           
 org.apache.poi.ss.usermodel.Workbook createNewWorkbook()
           
static java.util.List<java.io.File> createPNGImage(org.json.JSONObject content)
           
 void designTableInWorksheet(org.apache.poi.ss.usermodel.Sheet sheet, org.apache.poi.ss.usermodel.Workbook wb, org.apache.poi.ss.usermodel.CreationHelper createHelper, it.eng.spagobi.tools.dataset.common.datastore.IDataStore dataStore, int startRow, java.util.Locale locale)
           
 int getCellTypeBoolean()
           
 int getCellTypeNumeric()
           
 int getCellTypeString()
           
protected  org.apache.poi.ss.usermodel.ClientAnchor getClientAnchor(int col, int colend, int sheetRow, int height, int dx1, int dy1, int dx2, int dy2)
           
static java.util.List<java.io.File> getImage(org.json.JSONObject content)
           
 int getImageType(java.lang.String imgNameUpperCase)
           
 java.util.List<java.lang.String> getJsonVisibleSelectFields(org.json.JSONObject paramsJSON)
           
 org.json.JSONObject getOptionalUserFilters(org.json.JSONObject paramsJSON)
           
 int setFooter(org.apache.poi.ss.usermodel.Sheet sheet, org.json.JSONObject footer, org.apache.poi.ss.usermodel.CreationHelper createHelper, org.apache.poi.ss.usermodel.Workbook wb, org.apache.poi.ss.usermodel.Drawing patriarch, int sheetRow)
           
 int setHeader(org.apache.poi.ss.usermodel.Sheet sheet, org.json.JSONObject header, org.apache.poi.ss.usermodel.CreationHelper createHelper, org.apache.poi.ss.usermodel.Workbook wb, org.apache.poi.ss.usermodel.Drawing patriarch, int sheetRow)
           
 void setImageIntoWorkSheet(org.apache.poi.ss.usermodel.Workbook wb, org.apache.poi.ss.usermodel.Drawing drawing, java.io.File f, int col, int colend, int sheetRow, int height, int imgType)
           
static void transformSVGIntoJPEG(java.io.InputStream inputStream, java.io.OutputStream outputStream)
           
 
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

SHEETS_NUM

public static final java.lang.String SHEETS_NUM
See Also:
Constant Field Values

EXPORTED_SHEETS

public static final java.lang.String EXPORTED_SHEETS
See Also:
Constant Field Values

OUTPUT_FORMAT_JPEG

public static java.lang.String OUTPUT_FORMAT_JPEG

HEADER

public static final java.lang.String HEADER
See Also:
Constant Field Values

FOOTER

public static final java.lang.String FOOTER
See Also:
Constant Field Values

CONTENT

public static final java.lang.String CONTENT
See Also:
Constant Field Values

SHEET_TYPE

public static final java.lang.String SHEET_TYPE
See Also:
Constant Field Values

CHART

public static final java.lang.String CHART
See Also:
Constant Field Values

CROSSTAB

public static final java.lang.String CROSSTAB
See Also:
Constant Field Values

TABLE

public static final java.lang.String TABLE
See Also:
Constant Field Values

SVG

public static final java.lang.String SVG
See Also:
Constant Field Values

POSITION

public static final java.lang.String POSITION
See Also:
Constant Field Values

TITLE

public static final java.lang.String TITLE
See Also:
Constant Field Values

IMG

public static final java.lang.String IMG
See Also:
Constant Field Values

CENTER

public static final java.lang.String CENTER
See Also:
Constant Field Values

RIGHT

public static final java.lang.String RIGHT
See Also:
Constant Field Values

LEFT

public static final java.lang.String LEFT
See Also:
Constant Field Values

METADATA_TITLE_FONT_SIZE

public static final short METADATA_TITLE_FONT_SIZE
See Also:
Constant Field Values

METADATA_NAME_FONT_SIZE

public static final short METADATA_NAME_FONT_SIZE
See Also:
Constant Field Values

METADATA_VALUE_FONT_SIZE

public static final short METADATA_VALUE_FONT_SIZE
See Also:
Constant Field Values

FILTERS_TITLE_FONT_SIZE

public static final short FILTERS_TITLE_FONT_SIZE
See Also:
Constant Field Values

FILTERS_VALUES_FONT_SIZE

public static final short FILTERS_VALUES_FONT_SIZE
See Also:
Constant Field Values

TABLE_HEADER_FONT_SIZE

public static final short TABLE_HEADER_FONT_SIZE
See Also:
Constant Field Values

TABLE_CELL_CONTENT_FONT_SIZE

public static final short TABLE_CELL_CONTENT_FONT_SIZE
See Also:
Constant Field Values

HEADER_FONT_SIZE

public static final short HEADER_FONT_SIZE
See Also:
Constant Field Values

FONT_NAME

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

WorkSheetXLSExporter

public WorkSheetXLSExporter()
Method Detail

getOptionalUserFilters

public org.json.JSONObject getOptionalUserFilters(org.json.JSONObject paramsJSON)
                                           throws org.json.JSONException
Throws:
org.json.JSONException

createNewWorkbook

public org.apache.poi.ss.usermodel.Workbook createNewWorkbook()

getJsonVisibleSelectFields

public java.util.List<java.lang.String> getJsonVisibleSelectFields(org.json.JSONObject paramsJSON)
                                                            throws org.json.JSONException
Throws:
org.json.JSONException

designTableInWorksheet

public void designTableInWorksheet(org.apache.poi.ss.usermodel.Sheet sheet,
                                   org.apache.poi.ss.usermodel.Workbook wb,
                                   org.apache.poi.ss.usermodel.CreationHelper createHelper,
                                   it.eng.spagobi.tools.dataset.common.datastore.IDataStore dataStore,
                                   int startRow,
                                   java.util.Locale locale)
                            throws org.json.JSONException
Throws:
org.json.JSONException

setHeader

public int setHeader(org.apache.poi.ss.usermodel.Sheet sheet,
                     org.json.JSONObject header,
                     org.apache.poi.ss.usermodel.CreationHelper createHelper,
                     org.apache.poi.ss.usermodel.Workbook wb,
                     org.apache.poi.ss.usermodel.Drawing patriarch,
                     int sheetRow)
              throws org.json.JSONException,
                     java.io.IOException
Throws:
org.json.JSONException
java.io.IOException

setFooter

public int setFooter(org.apache.poi.ss.usermodel.Sheet sheet,
                     org.json.JSONObject footer,
                     org.apache.poi.ss.usermodel.CreationHelper createHelper,
                     org.apache.poi.ss.usermodel.Workbook wb,
                     org.apache.poi.ss.usermodel.Drawing patriarch,
                     int sheetRow)
              throws org.json.JSONException,
                     java.io.IOException
Throws:
org.json.JSONException
java.io.IOException

getImageType

public int getImageType(java.lang.String imgNameUpperCase)

buildHeaderTitleCellStyle

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

buildMetadataTitleCellStyle

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

buildMetadataNameCellStyle

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

buildMetadataValueCellStyle

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

buildFiltersTitleCellStyle

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

buildFiltersValuesCellStyle

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

setImageIntoWorkSheet

public void setImageIntoWorkSheet(org.apache.poi.ss.usermodel.Workbook wb,
                                  org.apache.poi.ss.usermodel.Drawing drawing,
                                  java.io.File f,
                                  int col,
                                  int colend,
                                  int sheetRow,
                                  int height,
                                  int imgType)
                           throws java.io.IOException
Throws:
java.io.IOException

getImage

public static java.util.List<java.io.File> getImage(org.json.JSONObject content)

createPNGImage

public static java.util.List<java.io.File> createPNGImage(org.json.JSONObject content)

createJPGImage

public static java.util.List<java.io.File> createJPGImage(org.json.JSONObject content)

transformSVGIntoJPEG

public static void transformSVGIntoJPEG(java.io.InputStream inputStream,
                                        java.io.OutputStream outputStream)

getCellTypeNumeric

public int getCellTypeNumeric()

getCellTypeString

public int getCellTypeString()

getCellTypeBoolean

public int getCellTypeBoolean()

getClientAnchor

protected org.apache.poi.ss.usermodel.ClientAnchor getClientAnchor(int col,
                                                                   int colend,
                                                                   int sheetRow,
                                                                   int height,
                                                                   int dx1,
                                                                   int dy1,
                                                                   int dx2,
                                                                   int dy2)