Package org.jxls.transform
Class TransformerDelegator
java.lang.Object
org.jxls.transform.TransformerDelegator
- All Implemented Interfaces:
Transformer
Decorator pattern for Transformer, in particular write() can be extended overriding beforeWrite()
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustTableSize(CellRef ref, Size size) protected voidvoidbooleandeleteSheet(String sheetName) voiddispose()Must be called after use.getCellData(CellRef cellRef) getTargetCellRef(CellRef cellRef) booleanThis property is used to recalculate all formulas before saving the workbook.booleanbooleanvoidvoidvoidsetEvaluateFormulas(boolean evaluateFormulas) This property is used to recalculate all formulas before saving the workbook.voidsetFormula(CellRef cellRef, String formulaString) voidsetFullFormulaRecalculationOnOpening(boolean fullFormulaRecalculationOnOpening) If you set this option to true, all formulas will be recalculated when the file is opened in MS Excel.voidvoidsetIgnoreColumnProps(boolean ignoreColumnProps) voidsetIgnoreRowProps(boolean ignoreRowProps) voidsetLogger(JxlsLogger logger) voidsetOutputStream(OutputStream outputStream) voidvoidupdateRowHeight(String srcSheetName, int srcRowNum, String targetSheetName, int targetRowNum) voidwrite()Writes Excel workbook to output stream and disposes the workbook.voidWrites Excel workbook to output stream but not close the stream designed to use with ZipOutputStream or other OutputStream for creates several xls files one time.
-
Field Details
-
transformer
-
-
Constructor Details
-
TransformerDelegator
-
-
Method Details
-
transform
public void transform(CellRef srcCellRef, CellRef targetCellRef, Context context, boolean updateRowHeight) - Specified by:
transformin interfaceTransformer
-
setOutputStream
- Specified by:
setOutputStreamin interfaceTransformer
-
writeButNotCloseStream
Description copied from interface:TransformerWrites Excel workbook to output stream but not close the stream designed to use with ZipOutputStream or other OutputStream for creates several xls files one time.- Specified by:
writeButNotCloseStreamin interfaceTransformer- Throws:
IOException- -
-
beforeWrite
protected void beforeWrite() -
write
Description copied from interface:TransformerWrites Excel workbook to output stream and disposes the workbook.- Specified by:
writein interfaceTransformer- Throws:
IOException- -
-
dispose
public void dispose()Description copied from interface:TransformerMust be called after use. write() calls this method.- Specified by:
disposein interfaceTransformer
-
setFormula
- Specified by:
setFormulain interfaceTransformer
-
getFormulaCells
- Specified by:
getFormulaCellsin interfaceTransformer
-
getCellData
- Specified by:
getCellDatain interfaceTransformer
-
getTargetCellRef
- Specified by:
getTargetCellRefin interfaceTransformer- Parameters:
cellRef- a source cell reference- Returns:
- a list of cell references into which the source cell was transformed
-
resetTargetCellRefs
public void resetTargetCellRefs()- Specified by:
resetTargetCellRefsin interfaceTransformer
-
resetArea
- Specified by:
resetAreain interfaceTransformer
-
clearCell
- Specified by:
clearCellin interfaceTransformer
-
getCommentedCells
- Specified by:
getCommentedCellsin interfaceTransformer
-
deleteSheet
- Specified by:
deleteSheetin interfaceTransformer
-
setHidden
- Specified by:
setHiddenin interfaceTransformer
-
updateRowHeight
public void updateRowHeight(String srcSheetName, int srcRowNum, String targetSheetName, int targetRowNum) - Specified by:
updateRowHeightin interfaceTransformer
-
adjustTableSize
- Specified by:
adjustTableSizein interfaceTransformer
-
isEvaluateFormulas
public boolean isEvaluateFormulas()Description copied from interface:TransformerThis property is used to recalculate all formulas before saving the workbook. This property is set to true if you don't open the file with MS Excel and just read it (e.g. with a unit test). The following documentation is POI specific.- Specified by:
isEvaluateFormulasin interfaceTransformer- Returns:
- true: calls
workbook.getCreationHelper().createFormulaEvaluator().evaluateAll()before writing the workbook. Please have a look at the POI documentation for more details. This does not work for streaming. Please be aware that POI supports only a subset of Excel formulas. If an unsupported formula is in the template the evaluation will fail.false (default): do nothing (hopefully MS Excel will recalculate all formulas while opening the file)
-
setEvaluateFormulas
public void setEvaluateFormulas(boolean evaluateFormulas) Description copied from interface:TransformerThis property is used to recalculate all formulas before saving the workbook. This property is set to true if you don't open the file with MS Excel and just read it (e.g. with a unit test). The following documentation is POI specific.- Specified by:
setEvaluateFormulasin interfaceTransformer- Parameters:
evaluateFormulas- true: callsworkbook.getCreationHelper().createFormulaEvaluator().evaluateAll()before writing the workbook. Please have a look at the POI documentation for more details. This does not work for streaming. Please be aware that POI supports only a subset of Excel formulas. If an unsupported formula is in the template the evaluation will fail.false (default): do nothing (hopefully MS Excel will recalculate all formulas while opening the file)
-
isFullFormulaRecalculationOnOpening
public boolean isFullFormulaRecalculationOnOpening()- Specified by:
isFullFormulaRecalculationOnOpeningin interfaceTransformer- Returns:
- false: do nothing, true: activate recalculation when opening
-
setFullFormulaRecalculationOnOpening
public void setFullFormulaRecalculationOnOpening(boolean fullFormulaRecalculationOnOpening) Description copied from interface:TransformerIf you set this option to true, all formulas will be recalculated when the file is opened in MS Excel. This changes the Excel file. This only works once.- Specified by:
setFullFormulaRecalculationOnOpeningin interfaceTransformer- Parameters:
fullFormulaRecalculationOnOpening- false: do nothing (default value), true: activate recalculation when opening
-
isForwardOnly
public boolean isForwardOnly()- Specified by:
isForwardOnlyin interfaceTransformer- Returns:
- true if the transformer can process cells only in a single pass
-
setLogger
- Specified by:
setLoggerin interfaceTransformer- Parameters:
logger- not null
-
getLogger
- Specified by:
getLoggerin interfaceTransformer- Returns:
- never null
-
setIgnoreColumnProps
public void setIgnoreColumnProps(boolean ignoreColumnProps) - Specified by:
setIgnoreColumnPropsin interfaceTransformer
-
setIgnoreRowProps
public void setIgnoreRowProps(boolean ignoreRowProps) - Specified by:
setIgnoreRowPropsin interfaceTransformer
-