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,java.io.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 java.util.Map<SColor,org.apache.poi.ss.usermodel.Color>colorTableprotected static intDEFAULT_ROW_HEIGHTprotected java.util.Map<java.lang.Integer,java.lang.Integer>exportedPicDataMapprotected java.util.Map<SFont,org.apache.poi.ss.usermodel.Font>fontTableprotected SBooksbookprotected java.util.Map<SCellStyle,org.apache.poi.ss.usermodel.CellStyle>styleTableThe map stores the exportedCellStyleduring exporting, so that we can reuse them for exporting other cells.protected java.util.Map<STableStyle,org.apache.poi.ss.usermodel.TableStyle>tbStyleTableprotected org.apache.poi.ss.usermodel.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 org.apache.poi.ss.usermodel.WorkbookcreatePoiBook()voidexport(SBook book, java.io.OutputStream fos)Export the model according to reversed depended order: book, sheet, defined name, cells, chart, pictures, validation.protected abstract voidexportAutoFilter(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected voidexportCell(org.apache.poi.ss.usermodel.Row poiRow, SCell cell)protected abstract voidexportChart(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected abstract voidexportColumnArray(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet, SColumnArray columnArr)protected abstract voidexportConditionalFormatting(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected abstract voidexportExtLst(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected voidexportMergedRegions(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected voidexportNamedRange(SBook book)protected abstract voidexportPassword(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected abstract voidexportPicture(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected voidexportPictureData(SBook book)protected voidexportRow(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet, SRow row)protected voidexportRowColumn(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected voidexportSheet(SSheet sheet)protected abstract voidexportSheetPr(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected voidexportSheetProtection(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)POI SheetProtection.protected abstract intexportTables(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet, int tbId)protected abstract voidexportValidation(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)protected abstract voidexportWorkbookProtection(SWorkbookProtection workbookProtection)protected java.lang.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 org.apache.poi.ss.usermodel.CellStyletoPOICellStyle(SCellStyle cellStyle)protected org.apache.poi.ss.usermodel.ColortoPOIColor(SColor color)protected org.apache.poi.ss.usermodel.CellStyletoPOIDefaultCellStyle(SCellStyle cellStyle)protected org.apache.poi.ss.usermodel.FonttoPOIFont(SFont font)Convert ZSS Font into POI Font.protected org.apache.poi.ss.usermodel.NamedStyletoPOINamedStyle(SNamedStyle cellStyle)protected org.apache.poi.ss.usermodel.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 org.apache.poi.ss.usermodel.Workbook workbook
Exporting destination, POI book model
-
sbook
protected SBook sbook
-
styleTable
protected java.util.Map<SCellStyle,org.apache.poi.ss.usermodel.CellStyle> styleTable
The map stores the exportedCellStyleduring exporting, so that we can reuse them for exporting other cells.
-
fontTable
protected java.util.Map<SFont,org.apache.poi.ss.usermodel.Font> fontTable
-
colorTable
protected java.util.Map<SColor,org.apache.poi.ss.usermodel.Color> colorTable
-
exportedPicDataMap
protected java.util.Map<java.lang.Integer,java.lang.Integer> exportedPicDataMap
-
tbStyleTable
protected java.util.Map<STableStyle,org.apache.poi.ss.usermodel.TableStyle> tbStyleTable
-
_exportPhase
protected io.keikai.range.impl.imexp.ExportPhase _exportPhase
-
_exportCache
protected boolean _exportCache
-
-
Method Detail
-
exportColumnArray
protected abstract void exportColumnArray(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet, SColumnArray columnArr)
-
createPoiBook
protected abstract org.apache.poi.ss.usermodel.Workbook createPoiBook()
-
exportWorkbookProtection
protected abstract void exportWorkbookProtection(SWorkbookProtection workbookProtection)
-
exportChart
protected abstract void exportChart(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportPicture
protected abstract void exportPicture(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportValidation
protected abstract void exportValidation(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportAutoFilter
protected abstract void exportAutoFilter(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportSheetPr
protected abstract void exportSheetPr(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportExtLst
protected abstract void exportExtLst(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportPassword
protected abstract void exportPassword(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportTables
protected abstract int exportTables(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet, int tbId)
-
exportConditionalFormatting
protected abstract void exportConditionalFormatting(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
export
public void export(SBook book, java.io.OutputStream fos) throws java.io.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:
java.io.IOException
-
exportPictureData
protected void exportPictureData(SBook book)
-
exportNamedRange
protected void exportNamedRange(SBook book)
-
exportSheet
protected void exportSheet(SSheet sheet)
-
exportMergedRegions
protected void exportMergedRegions(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportRowColumn
protected void exportRowColumn(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet)
-
exportRow
protected void exportRow(SSheet sheet, org.apache.poi.ss.usermodel.Sheet poiSheet, SRow row)
-
exportCell
protected void exportCell(org.apache.poi.ss.usermodel.Row poiRow, SCell cell)
-
getFormulaString
protected java.lang.String getFormulaString(SCell cell)
-
toPOIRichText
protected org.apache.poi.ss.usermodel.RichTextString toPOIRichText(SRichText richText)
-
toPOINamedStyle
protected org.apache.poi.ss.usermodel.NamedStyle toPOINamedStyle(SNamedStyle cellStyle)
-
toPOIDefaultCellStyle
protected org.apache.poi.ss.usermodel.CellStyle toPOIDefaultCellStyle(SCellStyle cellStyle)
-
toPOICellStyle
protected org.apache.poi.ss.usermodel.CellStyle toPOICellStyle(SCellStyle cellStyle)
-
toPOIColor
protected org.apache.poi.ss.usermodel.Color toPOIColor(SColor color)
-
toPOIFont
protected org.apache.poi.ss.usermodel.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, org.apache.poi.ss.usermodel.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
-
-