Package io.keikai.range.impl.imexp
Class AbstractExcelExporter
- java.lang.Object
-
- io.keikai.range.impl.imexp.AbstractExporter
-
- io.keikai.range.impl.imexp.AbstractExcelExporter
-
- All Implemented Interfaces:
SExporter,Serializable
- Direct Known Subclasses:
ExcelXlsExporter,ExcelXlsxExporter
public abstract class AbstractExcelExporter extends AbstractExporter
Common exporting behavior for both XLSX and XLS.- Since:
- 3.5.0
- Author:
- kuro, Hawk
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean_exportCacheprotected io.keikai.range.impl.imexp.ExportPhase_exportPhaseprotected Map<SColor,Color>colorTableprotected static intDEFAULT_ROW_HEIGHTprotected Map<Integer,Integer>exportedPicDataMapprotected Map<SFont,Font>fontTableprotected SBooksbookprotected Map<SCellStyle,CellStyle>styleTableThe map stores the exportedCellStyleduring exporting, so that we can reuse them for exporting other cells.protected Map<STableStyle,TableStyle>tbStyleTableprotected WorkbookworkbookExporting destination, POI book model
-
Constructor Summary
Constructors Constructor Description AbstractExcelExporter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddPOIDxfCellStyle(SExtraStyle extraStyle)Add DxfCellStyle as poi Dxf.protected voidaddPOITableStyle(STableStyle tableStyle)Add TableStyle as poi TableStyleprotected abstract WorkbookcreatePoiBook()voidexport(SBook book, OutputStream fos)Export the model according to reversed depended order: book, sheet, defined name, cells, chart, pictures, validation.protected abstract voidexportAutoFilter(SSheet sheet, Sheet poiSheet)protected voidexportCell(Row poiRow, SCell cell)protected abstract voidexportChart(SSheet sheet, Sheet poiSheet)protected abstract voidexportColumnArray(SSheet sheet, Sheet poiSheet, SColumnArray columnArr)protected abstract voidexportConditionalFormatting(SSheet sheet, Sheet poiSheet)protected abstract voidexportExtLst(SSheet sheet, Sheet poiSheet)protected voidexportMergedRegions(SSheet sheet, Sheet poiSheet)protected voidexportNamedRange(SBook book)protected abstract voidexportPassword(SSheet sheet, Sheet poiSheet)protected abstract voidexportPicture(SSheet sheet, Sheet poiSheet)protected voidexportPictureData(SBook book)protected voidexportRow(SSheet sheet, Sheet poiSheet, SRow row)protected voidexportRowColumn(SSheet sheet, Sheet poiSheet)protected voidexportSheet(SSheet sheet)protected abstract voidexportSheetPr(SSheet sheet, Sheet poiSheet)protected voidexportSheetProtection(SSheet sheet, Sheet poiSheet)POI SheetProtection.protected abstract intexportTables(SSheet sheet, Sheet poiSheet, int tbId)protected abstract voidexportValidation(SSheet sheet, Sheet poiSheet)protected abstract voidexportWorkbookProtection(SWorkbookProtection workbookProtection)protected StringgetFormulaString(SCell cell)protected booleanisExportCache()Returns whether export cached value into excel file.voidsetExportCache(boolean b)Set whether export cached value into excel file(must be called before export() is called.protected CellStyletoPOICellStyle(SCellStyle cellStyle)protected ColortoPOIColor(SColor color)protected CellStyletoPOIDefaultCellStyle(SCellStyle cellStyle)protected FonttoPOIFont(SFont font)Convert ZSS Font into POI Font.protected NamedStyletoPOINamedStyle(SNamedStyle cellStyle)protected RichTextStringtoPOIRichText(SRichText richText)-
Methods inherited from class io.keikai.range.impl.imexp.AbstractExporter
export, export, export
-
-
-
-
Field Detail
-
DEFAULT_ROW_HEIGHT
protected static final int DEFAULT_ROW_HEIGHT
- See Also:
- Constant Field Values
-
workbook
protected Workbook workbook
Exporting destination, POI book model
-
sbook
protected SBook sbook
-
styleTable
protected Map<SCellStyle,CellStyle> styleTable
The map stores the exportedCellStyleduring exporting, so that we can reuse them for exporting other cells.
-
tbStyleTable
protected Map<STableStyle,TableStyle> tbStyleTable
-
_exportPhase
protected io.keikai.range.impl.imexp.ExportPhase _exportPhase
-
_exportCache
protected boolean _exportCache
-
-
Method Detail
-
exportColumnArray
protected abstract void exportColumnArray(SSheet sheet, Sheet poiSheet, SColumnArray columnArr)
-
createPoiBook
protected abstract Workbook createPoiBook()
-
exportWorkbookProtection
protected abstract void exportWorkbookProtection(SWorkbookProtection workbookProtection)
-
exportConditionalFormatting
protected abstract void exportConditionalFormatting(SSheet sheet, Sheet poiSheet)
-
export
public void export(SBook book, OutputStream fos) throws IOException
Export the model according to reversed depended order: book, sheet, defined name, cells, chart, pictures, validation. Because named ranges (defined names) require sheet index, they should be imported after sheets created. Besides, cells, charts, and validations may have formulas referring to named ranges, they must be imported after named ranged. Pictures depend on cells.- Parameters:
book- the book to exportfos- the output stream to store data- Throws:
IOException
-
exportPictureData
protected void exportPictureData(SBook book)
-
exportNamedRange
protected void exportNamedRange(SBook book)
-
exportSheet
protected void exportSheet(SSheet sheet)
-
toPOIRichText
protected RichTextString toPOIRichText(SRichText richText)
-
toPOINamedStyle
protected NamedStyle toPOINamedStyle(SNamedStyle cellStyle)
-
toPOIDefaultCellStyle
protected CellStyle toPOIDefaultCellStyle(SCellStyle cellStyle)
-
toPOICellStyle
protected CellStyle toPOICellStyle(SCellStyle cellStyle)
-
toPOIFont
protected Font toPOIFont(SFont font)
Convert ZSS Font into POI Font. Cache font in the fontTable. If font exist, don't create a new one.- Parameters:
font-- Returns:
-
exportSheetProtection
protected void exportSheetProtection(SSheet sheet, Sheet poiSheet)
POI SheetProtection.- Parameters:
sheet- destination sheetpoiSheet- source POI sheet
-
setExportCache
public void setExportCache(boolean b)
Set whether export cached value into excel file(must be called before export() is called.- Parameters:
b-- Since:
- 3.7.0
-
isExportCache
protected boolean isExportCache()
Returns whether export cached value into excel file.- Returns:
- Since:
- 3.7.0
-
addPOIDxfCellStyle
protected void addPOIDxfCellStyle(SExtraStyle extraStyle)
Add DxfCellStyle as poi Dxf.- Parameters:
extraStyle-- Since:
- 3.8.2
-
addPOITableStyle
protected void addPOITableStyle(STableStyle tableStyle)
Add TableStyle as poi TableStyle- Parameters:
tableStyle-- Since:
- 3.8.3
-
-