private bool moveToNextRecordNoIndex() { //seek from current row record to start of cell data where that cell relates to the next row record XlsBiffRow rowRecord = m_currentRowRecord; if (rowRecord == null) { return(false); } if (rowRecord.RowIndex < m_depth) { m_stream.Seek(rowRecord.Offset + rowRecord.Size, SeekOrigin.Begin); do { if (m_stream.Position >= m_stream.Size) { return(false); } var record = m_stream.Read(); if (record is XlsBiffEOF) { return(false); } rowRecord = record as XlsBiffRow; } while (rowRecord == null || rowRecord.RowIndex < m_depth); } m_currentRowRecord = rowRecord; //m_depth = m_currentRowRecord.RowIndex; //we have now found the row record for the new row, the we need to seek forward to the first cell record XlsBiffBlankCell cell = null; do { if (m_stream.Position >= m_stream.Size) { return(false); } var record = m_stream.Read(); if (record is XlsBiffEOF) { return(false); } if (record.IsCell) { var candidateCell = record as XlsBiffBlankCell; if (candidateCell != null) { if (candidateCell.RowIndex == m_currentRowRecord.RowIndex) { cell = candidateCell; } } } } while (cell == null); m_cellOffset = cell.Offset; m_canRead = readWorkSheetRow(); //read last row //if (!m_canRead && m_depth > 0) m_canRead = true; //if (!m_canRead && m_dbCellAddrsIndex < (m_dbCellAddrs.Length - 1)) //{ // m_dbCellAddrsIndex++; // m_cellOffset = findFirstDataCellOffset((int)m_dbCellAddrs[m_dbCellAddrsIndex]); // m_canRead = readWorkSheetRow(); //} return(m_canRead); }
private void pushCellValue(XlsBiffBlankCell cell) { double _dValue; switch (cell.ID) { case BIFFRECORDTYPE.BOOLERR: if (cell.ReadByte(7) == 0) { m_cellsValues[cell.ColumnIndex] = cell.ReadByte(6) != 0; } break; case BIFFRECORDTYPE.BOOLERR_OLD: if (cell.ReadByte(8) == 0) { m_cellsValues[cell.ColumnIndex] = cell.ReadByte(7) != 0; } break; case BIFFRECORDTYPE.INTEGER: case BIFFRECORDTYPE.INTEGER_OLD: m_cellsValues[cell.ColumnIndex] = ((XlsBiffIntegerCell)cell).Value; break; case BIFFRECORDTYPE.NUMBER: case BIFFRECORDTYPE.NUMBER_OLD: _dValue = ((XlsBiffNumberCell)cell).Value; m_cellsValues[cell.ColumnIndex] = !m_ConvertOADate ? _dValue : tryConvertOADateTime(_dValue, cell.XFormat); break; case BIFFRECORDTYPE.LABEL: case BIFFRECORDTYPE.LABEL_OLD: case BIFFRECORDTYPE.RSTRING: m_cellsValues[cell.ColumnIndex] = ((XlsBiffLabelCell)cell).Value; break; case BIFFRECORDTYPE.LABELSST: string tmp = m_globals.SST.GetString(((XlsBiffLabelSSTCell)cell).SSTIndex); m_cellsValues[cell.ColumnIndex] = tmp; break; case BIFFRECORDTYPE.RK: _dValue = ((XlsBiffRKCell)cell).Value; m_cellsValues[cell.ColumnIndex] = !m_ConvertOADate ? _dValue : tryConvertOADateTime(_dValue, cell.XFormat); break; case BIFFRECORDTYPE.MULRK: XlsBiffMulRKCell _rkCell = (XlsBiffMulRKCell)cell; for (ushort j = cell.ColumnIndex; j <= _rkCell.LastColumnIndex; j++) { _dValue = _rkCell.GetValue(j); m_cellsValues[j] = !m_ConvertOADate ? _dValue : tryConvertOADateTime(_dValue, _rkCell.GetXF(j)); } break; case BIFFRECORDTYPE.BLANK: case BIFFRECORDTYPE.BLANK_OLD: case BIFFRECORDTYPE.MULBLANK: // Skip blank cells break; case BIFFRECORDTYPE.FORMULA: case BIFFRECORDTYPE.FORMULA_OLD: object _oValue = ((XlsBiffFormulaCell)cell).Value; if (null != _oValue && _oValue is FORMULAERROR) { _oValue = null; } else { m_cellsValues[cell.ColumnIndex] = !m_ConvertOADate ? _oValue : tryConvertOADateTime(_oValue, (ushort)(cell.XFormat)); //date time offset } break; default: break; } }