Search in sources :

Example 1 with CsvReadSheetHolder

use of com.alibaba.excel.read.metadata.holder.csv.CsvReadSheetHolder in project easyexcel by alibaba.

the class AnalysisContextImpl method currentSheet.

@Override
public void currentSheet(ReadSheet readSheet) {
    switch(readWorkbookHolder.getExcelType()) {
        case XLS:
            readSheetHolder = new XlsReadSheetHolder(readSheet, readWorkbookHolder);
            break;
        case XLSX:
            readSheetHolder = new XlsxReadSheetHolder(readSheet, readWorkbookHolder);
            break;
        case CSV:
            readSheetHolder = new CsvReadSheetHolder(readSheet, readWorkbookHolder);
            break;
        default:
            break;
    }
    currentReadHolder = readSheetHolder;
    if (readWorkbookHolder.getHasReadSheet().contains(readSheetHolder.getSheetNo())) {
        throw new ExcelAnalysisException("Cannot read sheet repeatedly.");
    }
    readWorkbookHolder.getHasReadSheet().add(readSheetHolder.getSheetNo());
    if (log.isDebugEnabled()) {
        log.debug("Began to read:{}", readSheetHolder);
    }
}
Also used : XlsxReadSheetHolder(com.alibaba.excel.read.metadata.holder.xlsx.XlsxReadSheetHolder) CsvReadSheetHolder(com.alibaba.excel.read.metadata.holder.csv.CsvReadSheetHolder) XlsReadSheetHolder(com.alibaba.excel.read.metadata.holder.xls.XlsReadSheetHolder) ExcelAnalysisException(com.alibaba.excel.exception.ExcelAnalysisException)

Aggregations

ExcelAnalysisException (com.alibaba.excel.exception.ExcelAnalysisException)1 CsvReadSheetHolder (com.alibaba.excel.read.metadata.holder.csv.CsvReadSheetHolder)1 XlsReadSheetHolder (com.alibaba.excel.read.metadata.holder.xls.XlsReadSheetHolder)1 XlsxReadSheetHolder (com.alibaba.excel.read.metadata.holder.xlsx.XlsxReadSheetHolder)1