public class XLSTransformer
extends java.lang.Object
This class uses excel template to generate excel file filled with required objects and collections.
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
XLSTransformer() |
XLSTransformer(Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public XLSTransformer()
public XLSTransformer(Configuration configuration)
public void registerPropertyPreprocessor(PropertyPreprocessor propPreprocessor)
propPreprocessor - - PropertyPreprocessor interface implementationpublic void registerRowProcessor(RowProcessor rowProcessor)
RowProcessor objectrowProcessor - RowProcessor to registerpublic void registerCellProcessor(CellProcessor cellProcessor)
CellProcessor objectcellProcessor - 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 formulaformulaResolver - FormulaResolver implementation to setpublic boolean isJexlInnerCollectionsAccess()
public void setJexlInnerCollectionsAccess(boolean jexlInnerCollectionsAccess)
public void groupCollection(java.lang.String collectionName)
collectionName - - Collection name to use for groupingpublic 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 fileParsePropertyException - if there were any problems in evaluating specified property value from a beanjava.io.IOException - if there were any access or input/output problems with source or destination fileorg.apache.poi.openxml4j.exceptions.InvalidFormatExceptionpublic 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 beansWorkbook generated by inserting beans into corresponding excel templateParsePropertyException - if there were any problems in evaluating specified property value from a beanorg.apache.poi.openxml4j.exceptions.InvalidFormatExceptionpublic 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 worksheetsWorkbook object containing the result of transformationParsePropertyException - - ParsePropertyException is thrown when some property can't be parsedorg.apache.poi.openxml4j.exceptions.InvalidFormatExceptionpublic 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 transformationWorkbook representing transformation resultParsePropertyException - in case property parsing failureorg.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 hidepublic 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)
Copyright © 2005-2014 jXLS Team. All Rights Reserved.