Package io.keikai.importer
Class XlsxImporter
- java.lang.Object
 - 
- io.keikai.range.impl.imexp.AbstractImporter
 - 
- io.keikai.importer.XlsxImporter
 
 
 
- 
- All Implemented Interfaces:
 SImporter,Serializable
public class XlsxImporter extends AbstractImporter implements Serializable
An excel xlsx importer- Since:
 - 5.0.0
 - Author:
 - jumperchen
 - See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected io.keikai.importer.ImportPhase_importPhaseprotected Map<String,Ptg[]>_sharedFormulaPtgArrayprotected SBookbooktarget book modelstatic StringBUILTIN_PRINT_AREAA built-in defined name that specifies the workbook's print areastatic StringBUILTIN_PRINT_TITLEA built-in defined name that specifies the row(s) or column(s) to repeat at the top of each printed page.static intERROR_DIV_0#DIV/0! - Division by zerostatic intERROR_FORMULAstatic intERROR_NA#N/A - Argument or function not availablestatic intERROR_NAME#NAME? - Wrong function or range namestatic intERROR_NULL#NULL! - Intersection of two cell ranges is emptystatic intERROR_NUM#NUM! - Value range overflowstatic intERROR_REF#REF! - Illegal or deleted cell referencestatic intERROR_VALUE#VALUE! - Wrong type of operandprotected Map<io.keikai.importer.PictureJson,Integer>importedPictureJsonSFontobject>protected Map<XlsxExtractor.XlsxXfExtractor,SCellStyle>importedXfsprotected StyleCachestyleCaches- 
Fields inherited from class io.keikai.range.impl.imexp.AbstractImporter
_importCache, BOOK_TYPE_KEY 
 - 
 
- 
Constructor Summary
Constructors Constructor Description XlsxImporter() 
- 
Method Summary
- 
Methods inherited from class io.keikai.range.impl.imexp.AbstractImporter
imports, imports, isImportCache, setImportCache 
 - 
 
 - 
 
- 
- 
Field Detail
- 
importedXfs
protected Map<XlsxExtractor.XlsxXfExtractor,SCellStyle> importedXfs
 
- 
styleCaches
protected StyleCache styleCaches
 
- 
_importPhase
protected io.keikai.importer.ImportPhase _importPhase
 
- 
importedPictureJson
protected Map<io.keikai.importer.PictureJson,Integer> importedPictureJson
SFontobject> 
- 
book
protected SBook book
target book model 
- 
BUILTIN_PRINT_AREA
public static final String BUILTIN_PRINT_AREA
A built-in defined name that specifies the workbook's print area- See Also:
 - Constant Field Values
 
 
- 
BUILTIN_PRINT_TITLE
public static final String BUILTIN_PRINT_TITLE
A built-in defined name that specifies the row(s) or column(s) to repeat at the top of each printed page.- See Also:
 - Constant Field Values
 
 
- 
ERROR_NULL
public static final int ERROR_NULL
#NULL! - Intersection of two cell ranges is empty- See Also:
 - Constant Field Values
 
 
- 
ERROR_DIV_0
public static final int ERROR_DIV_0
#DIV/0! - Division by zero- See Also:
 - Constant Field Values
 
 
- 
ERROR_VALUE
public static final int ERROR_VALUE
#VALUE! - Wrong type of operand- See Also:
 - Constant Field Values
 
 
- 
ERROR_REF
public static final int ERROR_REF
#REF! - Illegal or deleted cell reference- See Also:
 - Constant Field Values
 
 
- 
ERROR_NAME
public static final int ERROR_NAME
#NAME? - Wrong function or range name- See Also:
 - Constant Field Values
 
 
- 
ERROR_NUM
public static final int ERROR_NUM
#NUM! - Value range overflow- See Also:
 - Constant Field Values
 
 
- 
ERROR_NA
public static final int ERROR_NA
#N/A - Argument or function not available- See Also:
 - Constant Field Values
 
 
- 
ERROR_FORMULA
public static final int ERROR_FORMULA
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
imports
public SBook imports(InputStream inputStream, String bookName) throws IOException
Description copied from interface:SImporterImport book from a input stream- Specified by:
 importsin interfaceSImporter- Parameters:
 inputStream- the input streambookName- the book name for imported book- Returns:
 - the book instance
 - Throws:
 IOException
 
- 
importPrintArea
protected void importPrintArea(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
 
- 
getRepeatingRowsOrColumns
protected static CellRangeAddress getRepeatingRowsOrColumns(String refs, boolean rows)
 
- 
importHyperlinks
protected void importHyperlinks(XlsxExtractor.XlsxSheetExtractor xSheet)
 
- 
importVmlDrawing
protected void importVmlDrawing(XlsxExtractor.XlsxSheetExtractor xSheet)
 
- 
importComments
protected void importComments(XlsxExtractor.XlsxSheetExtractor xSheet)
 
- 
importDefaultChartSeriesColors
protected void importDefaultChartSeriesColors()
 
- 
importStyleSheet
protected void importStyleSheet(XlsxExtractor.XlsxStyleSheetExtractor extractor)
 
- 
importColors
protected void importColors(XlsxExtractor.XlsxRGBColorsExtractor extractor)
 
- 
importNumFmts
protected void importNumFmts(List<XlsxExtractor.XlsxNumFmtExtractor> extractors)
 
- 
importFonts
protected void importFonts(List<XlsxExtractor.XlsxFontExtractor> extractors)
 
- 
importFills
protected void importFills(List<XlsxExtractor.XlsxFillExtractor> extractors)
 
- 
importBorders
protected void importBorders(List<XlsxExtractor.XlsxBorderExtractor> extractors)
 
- 
createBorder
protected Borders.Border createBorder(XlsxExtractor.XlsxBorderExtractor extractor)
 
- 
createBorderPr
protected Borders.BorderPr createBorderPr(XlsxExtractor.XlsxBorderPrExtractor extractor)
 
- 
importAutoFilter
protected void importAutoFilter(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
 
- 
importSheetProtection
protected void importSheetProtection(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
 
- 
importValidation
protected void importValidation(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet, List<XlsxExtractor.XlsxExtExtractor> extList)
Reference BookHelper.validate() 
- 
importMergedRegions
protected void importMergedRegions(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
 
- 
importSparklines
protected void importSparklines(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet, List<XlsxExtractor.XlsxExtExtractor> extList)
 
- 
toColor
protected SColor toColor(XlsxExtractor.XlsxColorExtractor extractor)
 
- 
toSparklineViewAnchor
protected ViewAnchor toSparklineViewAnchor(String anchorRef, SSheet sheet)
 
- 
importDrawings
protected void importDrawings(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
 
- 
importPicture
protected void importPicture(io.keikai.importer.PictureJson pictureJson, XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet) 
- 
toViewAnchor
protected ViewAnchor toViewAnchor(io.keikai.importer.ShapeJson shapeJson, SSheet sheet)
 
- 
getAnchorWidthInPx
protected int getAnchorWidthInPx(io.keikai.importer.ShapeJson shapeJson, SSheet sheet)Reference DefaultBookWidgetLoader.getXSSFWidthInPx() 
- 
getAnchorHeightInPx
protected int getAnchorHeightInPx(io.keikai.importer.ShapeJson shapeJson, SSheet sheet)DefaultBookWidgetLoader.getXSSFHeightInPx() 
- 
getXoffsetInPixel
protected int getXoffsetInPixel(io.keikai.importer.ShapeJson shapeJson)
 
- 
getYoffsetInPixel
protected int getYoffsetInPixel(io.keikai.importer.ShapeJson shapeJson)
 
- 
importChart
protected void importChart(io.keikai.importer.ChartSpaceJson chartSpaceJson, XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet) 
- 
toChartGrouping
public SChart.ChartGrouping toChartGrouping(String grouping)
 
- 
toBarOverlap
protected int toBarOverlap(io.keikai.importer.ChartTypeJson json, SChart.ChartGrouping chartGrouping) 
- 
toChartLegendPosition
protected SChart.ChartLegendPosition toChartLegendPosition(String legendPosition)
 
- 
toChartAxisPosition
protected AbstractChartAxisAdv.Position toChartAxisPosition(String legendPosition)
 
- 
toChartAxisOrientation
protected AbstractChartAxisAdv.Orientation toChartAxisOrientation(String orientation)
 
- 
toChartAxisTickLabelPosition
protected AbstractChartAxisAdv.TickLabelPosition toChartAxisTickLabelPosition(String tickLabelPosition)
 
- 
toChartAxisCrosses
protected AbstractChartAxisAdv.Crosses toChartAxisCrosses(String crosses)
 
- 
toChartAxisLabelAlign
protected CategoryAxisImpl.LabelAlign toChartAxisLabelAlign(String labelAlign)
 
- 
toChartAxisTimeUnit
protected DateAxisImpl.TimeUnit toChartAxisTimeUnit(String timeUnit)
 
- 
toChartAxisCrossBetween
protected ValueAxisImpl.CrossBetween toChartAxisCrossBetween(String crossBetween)
 
- 
importCategory
protected void importCategory(io.keikai.importer.CategorySeriesJson categorySeriesJson, SGeneralChartData chartData) 
- 
importSeries
protected void importSeries(io.keikai.importer.SeriesJson seriesJson, SGeneralChartData chartData)reference ChartHelper.prepareCategoryModel() Category normally indicates the values show on X axis. Tile indicates the name for each series. 
- 
createSeries
protected AbstractSeriesAdv createSeries(io.keikai.importer.SeriesJson json, SGeneralChartData chartData)
 
- 
importCategorySeries
protected void importCategorySeries(io.keikai.importer.CategorySeriesJson categorySeriesJson, SGeneralChartData chartData, boolean isLine, boolean checkSmooth) 
- 
importXySeries
protected void importXySeries(io.keikai.importer.XYSeriesJson xySeriesJson, SGeneralChartData chartData) 
- 
importXyzSeries
protected void importXyzSeries(io.keikai.importer.XYZSeriesJson xyzSeriesJson, SGeneralChartData chartData)reference ChartHelper.prepareXYZModel()- Parameters:
 xyzSeriesJson-chartData-
 
- 
importAxis
protected void importAxis(io.keikai.importer.ChartSpaceJson chartSpaceJson, SChart chart) 
- 
getTitleFormula
protected String getTitleFormula(io.keikai.importer.SeriesJson seriesJson)
return a formula or generate a default title ("Series[N]")if title doesn't exist. reference ChartHelper.prepareTitle()- Parameters:
 seriesJson-- Returns:
 
 
- 
toChartType
protected SChart.ChartType toChartType(io.keikai.importer.ChartType chartType)
 
- 
importColumn
protected void importColumn(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
[ISO/IEC 29500-1 1st Edition] 18.3.1.13 col (Column Width & Formatting) By experiments, CT_Col is always created in ascending order by min and the range specified by min & max doesn't overlap each other.
For example: 
- 
getXlsxDefaultColumnWidth
protected double getXlsxDefaultColumnWidth(XlsxExtractor.XlsxSheetExtractor extractor, int charWidth)
 
- 
geDefaultColumnWidthPerBaseColWidth
public double geDefaultColumnWidthPerBaseColWidth(int baseWidth, int charWidth) 
- 
importRow
protected SRow importRow(XlsxExtractor.XlsxRowExtractor xRow, SSheet sheet)
 
- 
importCell
protected SCell importCell(XlsxExtractor.XlsxCellExtractor xCell, int row, SSheet sheet)
 
- 
getErrorText
public static final String getErrorText(int errorCode)
- Returns:
 - Standard Excel error literal for the specified error code.
 - Throws:
 IllegalArgumentException- if the specified error code is not one of the 7 standard error codes
 
- 
getErrorCode
public static final byte getErrorCode(String errorText)
 
- 
mustCalc
protected boolean mustCalc(SCell cell)
 
- 
importRichText
protected void importRichText(XlsxExtractor.XlsxRichTextExtractor xRichText, SRichText richText)
 
- 
createDxfZssFont
protected SFont createDxfZssFont(XlsxExtractor.XlsxFontExtractor xFont)
 
- 
createZssFont
protected SFont createZssFont(XlsxExtractor.XlsxFontExtractor xFont)
 
- 
getBorderHTMLColor
public static String getBorderHTMLColor(XlsxExtractor.XlsxColorExtractor color, XlsxExtractor.XlsxThemesExtractor themes, XlsxImporter xlsxImporter)
 
- 
getFontHTMLColor
public static String getFontHTMLColor(XlsxExtractor.XlsxColorExtractor color, XlsxExtractor.XlsxThemesExtractor themes, XlsxImporter xlsxImporter)
 
- 
getForegroundHTMLColor
public static String getForegroundHTMLColor(XlsxExtractor.XlsxColorExtractor color, XlsxExtractor.XlsxThemesExtractor themes, XlsxImporter xlsxImporter)
 
- 
getBackgroundHTMLColor
public static String getBackgroundHTMLColor(XlsxExtractor.XlsxColorExtractor color, XlsxExtractor.XlsxThemesExtractor themes, XlsxImporter xlsxImporter)
 
- 
getHTMLColor
protected static String getHTMLColor(XlsxExtractor.XlsxColorExtractor color, XlsxExtractor.XlsxThemesExtractor themes, XlsxImporter xlsxImporter, String nullAs)
 
- 
getSchemeHTMLColor
protected static SColor getSchemeHTMLColor(XlsxExtractor.XlsxSchemeClrExtractor color, XlsxExtractor.XlsxThemesExtractor themes)
 
- 
toUnderline
public static SFont.Underline toUnderline(String underline)
 
- 
toTypeOffset
public static SFont.TypeOffset toTypeOffset(String typeOffset)
 
- 
skipName
protected boolean skipName(XlsxExtractor.XlsxDefinedNameExtractor definedName)
 
- 
importNamedRange
protected void importNamedRange()
Name should be created after sheets created. A special defined name, _xlnm._FilterDatabase (xlsx) or _FilterDatabase (xls), stores the selected cells for auto-filter 
- 
convertZipInputStreamToInputStream
protected static InputStream convertZipInputStreamToInputStream(ZipInputStream in) throws IOException
- Throws:
 IOException
 
- 
newXlsxExtractor
protected XlsxExtractor.XlsxWorkbookExtractor newXlsxExtractor(InputStream inputStream) throws IOException
- Throws:
 IOException
 
- 
importDefaultCellStyles
protected void importDefaultCellStyles(XlsxExtractor.XlsxStyleSheetExtractor styleSheet)
 
- 
getNumberFormat
protected String getNumberFormat(XlsxExtractor.XlsxNumFmtExtractor extractor)
 
- 
toHorizontalAlignment
protected SCellStyle.Alignment toHorizontalAlignment(String align)
 
- 
toVerticalAlignment
protected SCellStyle.VerticalAlignment toVerticalAlignment(String align)
 
- 
convertToUIRotation
protected short convertToUIRotation(short rotation)
 
- 
importCellStyleXf
protected SCellStyle importCellStyleXf(XlsxExtractor.XlsxXfExtractor xCellXf, boolean inStyleTable)
 
- 
importCellXf
protected SCellStyle importCellXf(XlsxExtractor.XlsxXfExtractor xCellXf, boolean inStyleTable)
 
- 
importNamedStyles
protected void importNamedStyles(XlsxExtractor.XlsxStyleSheetExtractor styleSheet)
 
- 
importTables
protected void importTables(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet)
 
- 
importTableName
protected void importTableName(STable table)
 
- 
importColorFilter
protected SColorFilter importColorFilter(XlsxExtractor.XlsxColorFilterExtractor colorFilter)
 
- 
importAutoFilterColumns
protected void importAutoFilterColumns(XlsxExtractor.XlsxAutoFilterExtractor xFilter, SAutoFilter zssFilter)
 
- 
importCustomFilters
protected SCustomFilters importCustomFilters(XlsxExtractor.XlsxCustomFiltersExtractor xCustomFilters)
 
- 
importDynamicFilter
protected SDynamicFilter importDynamicFilter(XlsxExtractor.XlsxDynamicFilterExtractor xDynamicFilter)
 
- 
importTop10Filter
protected STop10Filter importTop10Filter(XlsxExtractor.XlsxTop10Extractor xTop10Filter)
 
- 
importExtraStyles
protected void importExtraStyles(XlsxExtractor.XlsxStyleSheetExtractor styleSheet)
 
- 
importExtraStyle
protected SExtraStyle importExtraStyle(XlsxExtractor.XlsxDxfExtractor xDxf)
 
- 
createSBorder
protected SBorder createSBorder(Borders.Border border)
 
- 
importTableStyles
protected void importTableStyles(XlsxExtractor.XlsxStyleSheetExtractor extractor)
 
- 
importTableStyleElem
protected STableStyleElem importTableStyleElem(XlsxExtractor.XlsxTableStyleElementExtractor styleElement)
 
- 
importTableStyle
protected STableStyle importTableStyle(XlsxExtractor.XlsxTableStyleExtractor tableStyle)
 
- 
setBookType
protected void setBookType(SBook book)
 
- 
importExternalBookLinks
protected void importExternalBookLinks(List<XlsxExtractor.XlsxExternalLinkExtractor> externalReferences)
 
- 
importWorkbookProtection
protected void importWorkbookProtection(XlsxExtractor.XlsxWorkbookExtractor xBook, SBook book)
 
- 
importSheets
protected void importSheets(List<XlsxExtractor.XlsxSheetExtractor> sheets)
 
- 
importSheet
protected SSheet importSheet(XlsxExtractor.XlsxSheetExtractor xSheet)
 
- 
importPassword
protected void importPassword(XlsxExtractor.XlsxSheetProtectionExtractor protectionExtractor, SSheet sheet)
 
- 
getPasswordHash
protected short getPasswordHash(String password)
 
- 
importConditionalFormatting
protected void importConditionalFormatting(XlsxExtractor.XlsxSheetExtractor xSheet, SSheet sheet, List<XlsxExtractor.XlsxExtExtractor> extList)
 
- 
prepareConditionalFormattingImpl
protected ConditionalFormattingImpl prepareConditionalFormattingImpl(SSheet sheet, XlsxExtractor.XlsxConditionalFormattingExtractor cf)
 
- 
prepareConditonalFormattingRuleImpl
protected ConditionalFormattingRuleImpl prepareConditonalFormattingRuleImpl(SConditionalFormatting cfi, XlsxExtractor.XlsxCfRuleExtractor xRule)
 
- 
prepareColorScale
protected SColorScale prepareColorScale(XlsxExtractor.XlsxCfRuleExtractor ctRule)
 
- 
prepareIconSet
protected SIconSet prepareIconSet(XlsxExtractor.XlsxCfRuleExtractor ctRule)
 
- 
prepareFormulas
protected void prepareFormulas(ConditionalFormattingRuleImpl cfri, XlsxExtractor.XlsxCfRuleExtractor xRule)
 
- 
prepareDataBar
protected SDataBar prepareDataBar(XlsxExtractor.XlsxCfRuleExtractor ctRule)
 
- 
prepareValueObject
protected SCFValueObject prepareValueObject(XlsxExtractor.XlsxCfvoExtractor ctvo)
 
- 
prepareCFIcon
protected SCFIcon prepareCFIcon(XlsxExtractor.XlsxCfIconExtractor cfIcon)
 
 - 
 
 -