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
_exportCache
protected io.keikai.range.impl.imexp.ExportPhase
_exportPhase
protected Map<SColor,Color>
colorTable
protected static int
DEFAULT_ROW_HEIGHT
protected Map<Integer,Integer>
exportedPicDataMap
protected Map<SFont,Font>
fontTable
protected SBook
sbook
protected Map<SCellStyle,CellStyle>
styleTable
The map stores the exportedCellStyle
during exporting, so that we can reuse them for exporting other cells.protected Map<STableStyle,TableStyle>
tbStyleTable
protected Workbook
workbook
Exporting 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 void
addPOIDxfCellStyle(SExtraStyle extraStyle)
Add DxfCellStyle as poi Dxf.protected void
addPOITableStyle(STableStyle tableStyle)
Add TableStyle as poi TableStyleprotected abstract Workbook
createPoiBook()
void
export(SBook book, OutputStream fos)
Export the model according to reversed depended order: book, sheet, defined name, cells, chart, pictures, validation.protected abstract void
exportAutoFilter(SSheet sheet, Sheet poiSheet)
protected void
exportCell(Row poiRow, SCell cell)
protected abstract void
exportChart(SSheet sheet, Sheet poiSheet)
protected abstract void
exportColumnArray(SSheet sheet, Sheet poiSheet, SColumnArray columnArr)
protected abstract void
exportConditionalFormatting(SSheet sheet, Sheet poiSheet)
protected abstract void
exportExtLst(SSheet sheet, Sheet poiSheet)
protected void
exportMergedRegions(SSheet sheet, Sheet poiSheet)
protected void
exportNamedRange(SBook book)
protected abstract void
exportPassword(SSheet sheet, Sheet poiSheet)
protected abstract void
exportPicture(SSheet sheet, Sheet poiSheet)
protected void
exportPictureData(SBook book)
protected void
exportRow(SSheet sheet, Sheet poiSheet, SRow row)
protected void
exportRowColumn(SSheet sheet, Sheet poiSheet)
protected void
exportSheet(SSheet sheet)
protected abstract void
exportSheetPr(SSheet sheet, Sheet poiSheet)
protected void
exportSheetProtection(SSheet sheet, Sheet poiSheet)
POI SheetProtection.protected abstract int
exportTables(SSheet sheet, Sheet poiSheet, int tbId)
protected abstract void
exportValidation(SSheet sheet, Sheet poiSheet)
protected abstract void
exportWorkbookProtection(SWorkbookProtection workbookProtection)
protected String
getFormulaString(SCell cell)
protected boolean
isExportCache()
Returns whether export cached value into excel file.void
setExportCache(boolean b)
Set whether export cached value into excel file(must be called before export() is called.protected CellStyle
toPOICellStyle(SCellStyle cellStyle)
protected Color
toPOIColor(SColor color)
protected CellStyle
toPOIDefaultCellStyle(SCellStyle cellStyle)
protected Font
toPOIFont(SFont font)
Convert ZSS Font into POI Font.protected NamedStyle
toPOINamedStyle(SNamedStyle cellStyle)
protected RichTextString
toPOIRichText(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 exportedCellStyle
during 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
-
-