public class PoiTransformer extends AbstractTransformer
Transformer
interfaceModifier and Type | Field and Description |
---|---|
static String |
POI_CONTEXT_KEY |
sheetMap
Constructor and Description |
---|
PoiTransformer(org.apache.poi.ss.usermodel.Workbook workbook,
boolean streaming) |
PoiTransformer(org.apache.poi.ss.usermodel.Workbook workbook,
boolean streaming,
int rowAccessWindowSize,
boolean compressTmpFiles,
boolean useSharedStringsTable) |
Modifier and Type | Method and Description |
---|---|
void |
addImage(AreaRef areaRef,
byte[] imageBytes,
ImageType imageType) |
void |
addImage(AreaRef areaRef,
byte[] imageBytes,
ImageType imageType,
Double scaleX,
Double scaleY) |
void |
adjustTableSize(CellRef ref,
Size size) |
void |
clearCell(CellRef cellRef) |
protected void |
clearCellValue(org.apache.poi.ss.usermodel.Cell poiCell) |
protected void |
copyMergedRegions(CellData sourceCellData,
CellRef destCell) |
static Context |
createInitialContext() |
static PoiTransformer |
createSxssfTransformer(org.apache.poi.ss.usermodel.Workbook workbook)
Creates transformer for given workbook.
|
static PoiTransformer |
createSxssfTransformer(org.apache.poi.ss.usermodel.Workbook workbook,
int rowAccessWindowSize,
boolean compressTmpFiles)
Creates transformer for given workbook and streaming parameters.
|
static PoiTransformer |
createSxssfTransformer(org.apache.poi.ss.usermodel.Workbook workbook,
int rowAccessWindowSize,
boolean compressTmpFiles,
boolean useSharedStringsTable)
Creates transformer for given workbook and streaming parameters.
|
static PoiTransformer |
createTransformer(InputStream is)
Creates transformer instance for given input stream
|
static PoiTransformer |
createTransformer(InputStream is,
OutputStream os)
Creates transformer from an input stream template and output stream
|
static PoiTransformer |
createTransformer(org.apache.poi.ss.usermodel.Workbook workbook)
Creates transformer instance from a
Workbook instance |
boolean |
deleteSheet(String sheetName) |
void |
dispose() |
protected void |
findAndRemoveExistingCellRegion(CellRef cellRef) |
org.apache.poi.ss.usermodel.CellStyle |
getCellStyle(CellRef cellRef) |
List<CellData> |
getCommentedCells() |
ExceptionHandler |
getExceptionHandler() |
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
protected org.apache.poi.ss.usermodel.Row |
getRowForClearCell(org.apache.poi.ss.usermodel.Sheet sheet,
CellRef cellRef) |
org.apache.poi.ss.usermodel.Workbook |
getWorkbook() |
org.apache.poi.xssf.usermodel.XSSFWorkbook |
getXSSFWorkbook() |
boolean |
isForwardOnly() |
protected boolean |
isStreaming() |
protected CellData |
isTransformable(CellRef srcCellRef,
CellRef targetCellRef) |
void |
mergeCells(CellRef cellRef,
int rows,
int cols) |
protected void |
removeCellComment(org.apache.poi.ss.usermodel.Sheet sheet,
int rowNum,
int colNum) |
void |
resetArea(AreaRef areaRef) |
void |
setExceptionHandler(ExceptionHandler exceptionHandler) |
void |
setFormula(CellRef cellRef,
String formulaString) |
void |
setHidden(String sheetName,
boolean hidden) |
void |
setInputStream(InputStream is) |
void |
setOutputStream(OutputStream outputStream) |
void |
transform(CellRef srcCellRef,
CellRef targetCellRef,
Context context,
boolean updateRowHeightFlag) |
protected void |
transformCell(CellRef srcCellRef,
CellRef targetCellRef,
Context context,
boolean updateRowHeightFlag,
CellData cellData,
org.apache.poi.ss.usermodel.Sheet destSheet,
org.apache.poi.ss.usermodel.Row destRow) |
void |
updateRowHeight(String srcSheetName,
int srcRowNum,
String targetSheetName,
int targetRowNum) |
void |
write() |
void |
writeButNotCloseStream() |
getCellData, getFormulaCells, getTargetCellRef, getTransformationConfig, isEvaluateFormulas, isFullFormulaRecalculationOnOpening, isIgnoreColumnProps, isIgnoreRowProps, resetTargetCellRefs, setEvaluateFormulas, setFullFormulaRecalculationOnOpening, setIgnoreColumnProps, setIgnoreRowProps, setTransformationConfig
public static final String POI_CONTEXT_KEY
public PoiTransformer(org.apache.poi.ss.usermodel.Workbook workbook, boolean streaming)
workbook
- source workbook to transformstreaming
- false: without streaming, true: with streaming (with default parameter values)public PoiTransformer(org.apache.poi.ss.usermodel.Workbook workbook, boolean streaming, int rowAccessWindowSize, boolean compressTmpFiles, boolean useSharedStringsTable)
workbook
- source workbook to transformstreaming
- flag to set if SXSSF stream support is enabledrowAccessWindowSize
- only used if streaming is truecompressTmpFiles
- only used if streaming is trueuseSharedStringsTable
- only used if streaming is trueprotected boolean isStreaming()
public void setInputStream(InputStream is)
public static PoiTransformer createTransformer(InputStream is, OutputStream os)
is
- input stream to read the Excel template file. Format can be XLSX (recommended) or XLS.os
- output stream to write the Excel file. Must be the same format.PoiTransformer
instancepublic static PoiTransformer createTransformer(InputStream is)
is
- input stream for the Excel template file. Format can be XLSX (recommended) or XLS.CannotOpenWorkbookException
- if an error occurs during opening the Excel workbookpublic static PoiTransformer createTransformer(org.apache.poi.ss.usermodel.Workbook workbook)
Workbook
instanceworkbook
- Excel templatepublic static PoiTransformer createSxssfTransformer(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
- Excel template. Format must be XLSX.public static PoiTransformer createSxssfTransformer(org.apache.poi.ss.usermodel.Workbook workbook, int rowAccessWindowSize, boolean compressTmpFiles)
workbook
- Excel template. Format must be XLSX.rowAccessWindowSize
- -compressTmpFiles
- -public static PoiTransformer createSxssfTransformer(org.apache.poi.ss.usermodel.Workbook workbook, int rowAccessWindowSize, boolean compressTmpFiles, boolean useSharedStringsTable)
workbook
- Excel template. Format must be XLSX.rowAccessWindowSize
- -compressTmpFiles
- -useSharedStringsTable
- -public static Context createInitialContext()
public boolean isForwardOnly()
isForwardOnly
in interface Transformer
isForwardOnly
in class AbstractTransformer
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
public void transform(CellRef srcCellRef, CellRef targetCellRef, Context context, boolean updateRowHeightFlag)
protected void transformCell(CellRef srcCellRef, CellRef targetCellRef, Context context, boolean updateRowHeightFlag, CellData cellData, org.apache.poi.ss.usermodel.Sheet destSheet, org.apache.poi.ss.usermodel.Row destRow)
public ExceptionHandler getExceptionHandler()
public void setExceptionHandler(ExceptionHandler exceptionHandler)
public void resetArea(AreaRef areaRef)
protected final void findAndRemoveExistingCellRegion(CellRef cellRef)
protected void clearCellValue(org.apache.poi.ss.usermodel.Cell poiCell)
public void clearCell(CellRef cellRef)
protected org.apache.poi.ss.usermodel.Row getRowForClearCell(org.apache.poi.ss.usermodel.Sheet sheet, CellRef cellRef)
protected final void removeCellComment(org.apache.poi.ss.usermodel.Sheet sheet, int rowNum, int colNum)
public void addImage(AreaRef areaRef, byte[] imageBytes, ImageType imageType, Double scaleX, Double scaleY)
addImage
in interface Transformer
addImage
in class AbstractTransformer
public void write() throws IOException
IOException
public void writeButNotCloseStream() throws IOException
writeButNotCloseStream
in interface Transformer
writeButNotCloseStream
in class AbstractTransformer
IOException
public void dispose()
dispose
in interface Transformer
dispose
in class AbstractTransformer
public OutputStream getOutputStream()
public void setOutputStream(OutputStream outputStream)
public InputStream getInputStream()
public org.apache.poi.ss.usermodel.CellStyle getCellStyle(CellRef cellRef)
public boolean deleteSheet(String sheetName)
deleteSheet
in interface Transformer
deleteSheet
in class AbstractTransformer
public void setHidden(String sheetName, boolean hidden)
public void updateRowHeight(String srcSheetName, int srcRowNum, String targetSheetName, int targetRowNum)
public org.apache.poi.xssf.usermodel.XSSFWorkbook getXSSFWorkbook()
public void adjustTableSize(CellRef ref, Size size)
adjustTableSize
in interface Transformer
adjustTableSize
in class AbstractTransformer
public void mergeCells(CellRef cellRef, int rows, int cols)
mergeCells
in interface Transformer
mergeCells
in class AbstractTransformer
Copyright © 2023. All rights reserved.