|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jxls.transformer.XLSTransformer
public class XLSTransformer
This class uses excel template to generate excel file filled with required objects and collections.
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
XLSTransformer()
|
|
XLSTransformer(Configuration configuration)
|
|
| Method Summary | |
|---|---|
java.lang.String[] |
getColumnPropertyNamesToHide()
|
short[] |
getColumnsToHide()
|
Configuration |
getConfiguration()
|
FormulaResolver |
getFormulaResolver()
|
protected java.lang.String |
getSpreadsheetToReName(java.lang.String name)
|
void |
groupCollection(java.lang.String collectionName)
Set this collection to be grouped (outlined). |
boolean |
isJexlInnerCollectionsAccess()
|
protected boolean |
isSpreadsheetToRemove(java.lang.String name)
|
protected boolean |
isSpreadsheetToRename(java.lang.String name)
|
void |
markAsFixedSizeCollection(java.lang.String collectionName)
Mark a collection as static collection. |
void |
registerCellProcessor(CellProcessor cellProcessor)
Registers CellProcessor object |
void |
registerPropertyPreprocessor(PropertyPreprocessor propPreprocessor)
Registers Property Preprocessor that will be applied before main template transformation it is possible to have many Property Preprocessors |
void |
registerRowProcessor(RowProcessor rowProcessor)
Registers RowProcessor object |
void |
setColumnPropertyNamesToHide(java.lang.String[] columnPropertyNamesToHide)
Set the columns to hide in result XLS |
void |
setColumnsToHide(short[] columnsToHide)
Sets the columns to hide in result XLS |
void |
setConfiguration(Configuration configuration)
|
void |
setFormulaResolver(FormulaResolver formulaResolver)
Sets FormulaResolver to be used in resolving formula |
void |
setJexlInnerCollectionsAccess(boolean jexlInnerCollectionsAccess)
|
void |
setSpreadsheetsToRemove(java.lang.String[] names)
Set spreadsheets with given names to be hidden |
void |
setSpreadsheetToRename(java.lang.String name,
java.lang.String newName)
|
org.apache.poi.ss.usermodel.Workbook |
transformMultipleSheetsList(java.io.InputStream is,
java.util.List objects,
java.util.List newSheetNames,
java.lang.String beanName,
java.util.Map beanParams,
int startSheetNum)
This method transforms given XLS input stream template into multiple sheets workbook creating separate Excel worksheet for every object in the list |
void |
transformWorkbook(org.apache.poi.ss.usermodel.Workbook hssfWorkbook,
java.util.Map beanParams)
|
org.apache.poi.ss.usermodel.Workbook |
transformXLS(java.io.InputStream is,
java.util.List templateSheetNameList,
java.util.List sheetNameList,
java.util.List beanParamsList)
Multiple sheet template multiple transform. |
org.apache.poi.ss.usermodel.Workbook |
transformXLS(java.io.InputStream is,
java.util.Map beanParams)
Creates Workbook instance based on .xls template from a given InputStream and a number of beans |
void |
transformXLS(java.lang.String srcFilePath,
java.util.Map beanParams,
java.lang.String destFilePath)
Creates new .xls file at a given path using specified excel template file and a number of beans. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public XLSTransformer()
public XLSTransformer(Configuration configuration)
| Method Detail |
|---|
public void registerPropertyPreprocessor(PropertyPreprocessor propPreprocessor)
propPreprocessor - - PropertyPreprocessor interface implementationpublic void registerRowProcessor(RowProcessor rowProcessor)
RowProcessor object
rowProcessor - RowProcessor to registerpublic void registerCellProcessor(CellProcessor cellProcessor)
CellProcessor object
cellProcessor - to registerpublic void markAsFixedSizeCollection(java.lang.String collectionName)
collectionName - - Collection name to mark as fixed size collectionpublic Configuration getConfiguration()
public void setConfiguration(Configuration configuration)
public FormulaResolver getFormulaResolver()
FormulaResolver used to resolve coded formulaspublic void setFormulaResolver(FormulaResolver formulaResolver)
FormulaResolver to be used in resolving formula
formulaResolver - FormulaResolver implementation to setpublic boolean isJexlInnerCollectionsAccess()
public void setJexlInnerCollectionsAccess(boolean jexlInnerCollectionsAccess)
public void groupCollection(java.lang.String collectionName)
collectionName - - Collection name to use for grouping
public void transformXLS(java.lang.String srcFilePath,
java.util.Map beanParams,
java.lang.String destFilePath)
throws ParsePropertyException,
java.io.IOException,
org.apache.poi.openxml4j.exceptions.InvalidFormatException
transformXLS(InputStream is, Map beanParams) passing input stream from a template file
and then writing resulted Workbook into required output file.
srcFilePath - Path to source .xls template filebeanParams - Map of beans to be applied to .xls template file with keys corresponding to bean aliases in templatedestFilePath - Path to result .xls file
ParsePropertyException - if there were any problems in evaluating specified property value from a bean
java.io.IOException - if there were any access or input/output problems with source or destination file
org.apache.poi.openxml4j.exceptions.InvalidFormatException
public org.apache.poi.ss.usermodel.Workbook transformXLS(java.io.InputStream is,
java.util.Map beanParams)
throws ParsePropertyException,
org.apache.poi.openxml4j.exceptions.InvalidFormatException
is - xls InputStream with requiredbeanParams - Beans in a map under keys used in .xls template to access to the beans
Workbook generated by inserting beans into corresponding excel template
ParsePropertyException - if there were any problems in evaluating specified property value from a bean
org.apache.poi.openxml4j.exceptions.InvalidFormatException
public void transformWorkbook(org.apache.poi.ss.usermodel.Workbook hssfWorkbook,
java.util.Map beanParams)
public org.apache.poi.ss.usermodel.Workbook transformMultipleSheetsList(java.io.InputStream is,
java.util.List objects,
java.util.List newSheetNames,
java.lang.String beanName,
java.util.Map beanParams,
int startSheetNum)
throws ParsePropertyException,
org.apache.poi.openxml4j.exceptions.InvalidFormatException
is - - InputStream for source XLS template fileobjects - - List of beans where each list item should be exported into a separated worksheetnewSheetNames - - Sheet names to be used for newly created worksheetsbeanName - - Bean name to be used for a list item when processing sheetbeanParams - - Common bean map containing all other objects to be used in the workbookstartSheetNum - - Worksheet number (zero based) of the worksheet that needs to be used to create multiple worksheets
Workbook object containing the result of transformation
ParsePropertyException - - ParsePropertyException is thrown when some property can't be parsed
org.apache.poi.openxml4j.exceptions.InvalidFormatException
public org.apache.poi.ss.usermodel.Workbook transformXLS(java.io.InputStream is,
java.util.List templateSheetNameList,
java.util.List sheetNameList,
java.util.List beanParamsList)
throws ParsePropertyException,
org.apache.poi.openxml4j.exceptions.InvalidFormatException
is - the InputStream of the workbook template containing the n template sheetstemplateSheetNameList - the ordered list of the template sheet name used in the transformation.sheetNameList - the ordered list of the resulting sheet name after transformationbeanParamsList - the ordered list of beanParams used in the transformation
Workbook representing transformation result
ParsePropertyException - in case property parsing failure
org.apache.poi.openxml4j.exceptions.InvalidFormatExceptionpublic short[] getColumnsToHide()
public void setColumnsToHide(short[] columnsToHide)
columnsToHide - - Column numbers to hidepublic java.lang.String[] getColumnPropertyNamesToHide()
public void setColumnPropertyNamesToHide(java.lang.String[] columnPropertyNamesToHide)
columnPropertyNamesToHide - - The names of bean properties for which all columns
containing this properties should be hiddenpublic void setSpreadsheetsToRemove(java.lang.String[] names)
names - - Names of the worksheets to hide
public void setSpreadsheetToRename(java.lang.String name,
java.lang.String newName)
protected boolean isSpreadsheetToRemove(java.lang.String name)
protected boolean isSpreadsheetToRename(java.lang.String name)
protected java.lang.String getSpreadsheetToReName(java.lang.String name)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||