Search in sources :

Example 6 with ReadRowHolder

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

the class RowTagHandler method startElement.

@Override
public void startElement(XlsxReadContext xlsxReadContext, String name, Attributes attributes) {
    XlsxReadSheetHolder xlsxReadSheetHolder = xlsxReadContext.xlsxReadSheetHolder();
    int rowIndex = PositionUtils.getRowByRowTagt(attributes.getValue(ExcelXmlConstants.ATTRIBUTE_R), xlsxReadSheetHolder.getRowIndex());
    Integer lastRowIndex = xlsxReadContext.readSheetHolder().getRowIndex();
    while (lastRowIndex + 1 < rowIndex) {
        xlsxReadContext.readRowHolder(new ReadRowHolder(lastRowIndex + 1, RowTypeEnum.EMPTY, xlsxReadSheetHolder.getGlobalConfiguration(), new LinkedHashMap<Integer, Cell>()));
        xlsxReadContext.analysisEventProcessor().endRow(xlsxReadContext);
        xlsxReadSheetHolder.setColumnIndex(null);
        xlsxReadSheetHolder.setCellMap(new LinkedHashMap<Integer, Cell>());
        lastRowIndex++;
    }
    xlsxReadSheetHolder.setRowIndex(rowIndex);
}
Also used : XlsxReadSheetHolder(com.alibaba.excel.read.metadata.holder.xlsx.XlsxReadSheetHolder) ReadRowHolder(com.alibaba.excel.read.metadata.holder.ReadRowHolder) Cell(com.alibaba.excel.metadata.Cell) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ReadRowHolder (com.alibaba.excel.read.metadata.holder.ReadRowHolder)6 Cell (com.alibaba.excel.metadata.Cell)5 ReadCellData (com.alibaba.excel.metadata.data.ReadCellData)3 RowTypeEnum (com.alibaba.excel.enums.RowTypeEnum)2 XlsReadSheetHolder (com.alibaba.excel.read.metadata.holder.xls.XlsReadSheetHolder)2 XlsxReadSheetHolder (com.alibaba.excel.read.metadata.holder.xlsx.XlsxReadSheetHolder)2 LinkedHashMap (java.util.LinkedHashMap)2 ExcelAnalysisException (com.alibaba.excel.exception.ExcelAnalysisException)1 ExcelAnalysisStopException (com.alibaba.excel.exception.ExcelAnalysisStopException)1 ReadListener (com.alibaba.excel.read.listener.ReadListener)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 LastCellOfRowDummyRecord (org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord)1 MissingCellDummyRecord (org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord)1