Esempio n. 1
0
        private void pushCellValue(XlsBiffBlankCell cell)
        {
            double num;

            switch (cell.ID)
            {
            case BIFFRECORDTYPE.RK:
                num = ((XlsBiffRKCell)cell).Value;
                this.m_cellsValues[cell.ColumnIndex] = !this.m_ConvertOADate ? num : this.tryConvertOADateTime(num, cell.XFormat);
                return;

            case BIFFRECORDTYPE.FORMULA:
            case BIFFRECORDTYPE.FORMULA_OLD:
            {
                object obj2 = ((XlsBiffFormulaCell)cell).Value;
                if ((obj2 != null) && (obj2 is FORMULAERROR))
                {
                    obj2 = null;
                    return;
                }
                this.m_cellsValues[cell.ColumnIndex] = !this.m_ConvertOADate ? obj2 : this.tryConvertOADateTime(obj2, cell.XFormat);
                break;
            }

            case BIFFRECORDTYPE.BLANK:
            case BIFFRECORDTYPE.BLANK_OLD:
            case BIFFRECORDTYPE.MULBLANK:
                break;

            case BIFFRECORDTYPE.INTEGER:
            case BIFFRECORDTYPE.INTEGER_OLD:
                this.m_cellsValues[cell.ColumnIndex] = ((XlsBiffIntegerCell)cell).Value;
                return;

            case BIFFRECORDTYPE.NUMBER:
            case BIFFRECORDTYPE.NUMBER_OLD:
                num = ((XlsBiffNumberCell)cell).Value;
                this.m_cellsValues[cell.ColumnIndex] = !this.m_ConvertOADate ? num : this.tryConvertOADateTime(num, cell.XFormat);
                return;

            case BIFFRECORDTYPE.LABEL:
            case BIFFRECORDTYPE.LABEL_OLD:
            case BIFFRECORDTYPE.RSTRING:
                this.m_cellsValues[cell.ColumnIndex] = ((XlsBiffLabelCell)cell).Value;
                return;

            case BIFFRECORDTYPE.BOOLERR:
                if (cell.ReadByte(7) != 0)
                {
                    break;
                }
                this.m_cellsValues[cell.ColumnIndex] = cell.ReadByte(6) != 0;
                return;

            case BIFFRECORDTYPE.LABELSST:
            {
                string str = this.m_globals.SST.GetString(((XlsBiffLabelSSTCell)cell).SSTIndex);
                this.m_cellsValues[cell.ColumnIndex] = str;
                return;
            }

            case BIFFRECORDTYPE.BOOLERR_OLD:
                if (cell.ReadByte(8) != 0)
                {
                    break;
                }
                this.m_cellsValues[cell.ColumnIndex] = cell.ReadByte(7) != 0;
                return;

            case BIFFRECORDTYPE.MULRK:
            {
                XlsBiffMulRKCell cell2 = (XlsBiffMulRKCell)cell;
                for (ushort i = cell.ColumnIndex; i <= cell2.LastColumnIndex; i = (ushort)(i + 1))
                {
                    num = cell2.GetValue(i);
                    this.m_cellsValues[i] = !this.m_ConvertOADate ? num : this.tryConvertOADateTime(num, cell2.GetXF(i));
                }
                return;
            }

            default:
                return;
            }
        }
        private void pushCellValue(XlsBiffBlankCell cell)
        {
            double _dValue;

            LogManager.Log(this).Debug("pushCellValue {0}", cell.ID);
            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] = !ConvertOaDate ?
                                                  _dValue : tryConvertOADateTime(_dValue, cell.XFormat);

                LogManager.Log(this).Debug("VALUE: {0}", _dValue);
                break;

            case BIFFRECORDTYPE.LABEL:
            case BIFFRECORDTYPE.LABEL_OLD:
            case BIFFRECORDTYPE.RSTRING:

                m_cellsValues[cell.ColumnIndex] = ((XlsBiffLabelCell)cell).Value;

                LogManager.Log(this).Debug("VALUE: {0}", m_cellsValues[cell.ColumnIndex]);
                break;

            case BIFFRECORDTYPE.LABELSST:
                string tmp = m_globals.SST.GetString(((XlsBiffLabelSSTCell)cell).SSTIndex);
                LogManager.Log(this).Debug("VALUE: {0}", tmp);
                m_cellsValues[cell.ColumnIndex] = tmp;
                break;

            case BIFFRECORDTYPE.RK:

                _dValue = ((XlsBiffRKCell)cell).Value;

                m_cellsValues[cell.ColumnIndex] = !ConvertOaDate ?
                                                  _dValue : tryConvertOADateTime(_dValue, cell.XFormat);

                LogManager.Log(this).Debug("VALUE: {0}", _dValue);
                break;

            case BIFFRECORDTYPE.MULRK:

                XlsBiffMulRKCell _rkCell = (XlsBiffMulRKCell)cell;
                for (ushort j = cell.ColumnIndex; j <= _rkCell.LastColumnIndex; j++)
                {
                    _dValue = _rkCell.GetValue(j);
                    LogManager.Log(this).Debug("VALUE[{1}]: {0}", _dValue, j);
                    m_cellsValues[j] = !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] = !ConvertOaDate ?
                                                      _oValue : tryConvertOADateTime(_oValue, (ushort)(cell.XFormat));  //date time offset
                }

                break;

            default:
                break;
            }
        }
Esempio n. 3
0
        private void pushCellValue(XlsBiffBlankCell cell)
        {
            double _dValue;

            bool hasValue = true;

            switch (cell.ID)
            {
            case BIFFRECORDTYPE.BOOLERR:
                if (cell.ReadByte(7) == 0)
                {
                    m_cellsValues[cell.ColumnIndex] = new XlsCell(cell.ReadByte(6) != 0);
                }
                else
                {
                    hasValue = false;
                }
                break;

            case BIFFRECORDTYPE.BOOLERR_OLD:
                if (cell.ReadByte(8) == 0)
                {
                    m_cellsValues[cell.ColumnIndex] = new XlsCell(cell.ReadByte(7) != 0);
                }
                else
                {
                    hasValue = false;
                }
                break;

            case BIFFRECORDTYPE.INTEGER:
            case BIFFRECORDTYPE.INTEGER_OLD:
                m_cellsValues[cell.ColumnIndex] = new XlsCell(((XlsBiffIntegerCell)cell).Value);
                break;

            case BIFFRECORDTYPE.NUMBER:
            case BIFFRECORDTYPE.NUMBER_OLD:
                _dValue = ((XlsBiffNumberCell)cell).Value;
                m_cellsValues[cell.ColumnIndex] =
                    new XlsCell(_dValue);
                break;

            case BIFFRECORDTYPE.LABEL:
            case BIFFRECORDTYPE.LABEL_OLD:
            case BIFFRECORDTYPE.RSTRING:
                m_cellsValues[cell.ColumnIndex] = new XlsCell(((XlsBiffLabelCell)cell).Value);
                break;

            case BIFFRECORDTYPE.LABELSST:
                string tmp = m_globals.SST.GetString(((XlsBiffLabelSSTCell)cell).SSTIndex);
                m_cellsValues[cell.ColumnIndex] = new XlsCell(tmp);
                break;

            case BIFFRECORDTYPE.RK:
                _dValue = ((XlsBiffRKCell)cell).Value;
                m_cellsValues[cell.ColumnIndex] = new XlsCell(_dValue);
                break;

            case BIFFRECORDTYPE.MULRK:
                var  _rkCell = (XlsBiffMulRKCell)cell;
                bool hasSet  = false;
                for (ushort j = cell.ColumnIndex; j <= _rkCell.LastColumnIndex; j++)
                {
                    _dValue          = _rkCell.GetValue(j);
                    m_cellsValues[j] = new XlsCell(_dValue);
                    hasSet           = true;
                }
                hasValue = hasSet;

                break;

            case BIFFRECORDTYPE.BLANK:
            case BIFFRECORDTYPE.BLANK_OLD:
            case BIFFRECORDTYPE.MULBLANK:
                // Skip blank cells
                hasValue = false;
                break;

            case BIFFRECORDTYPE.FORMULA:
            case BIFFRECORDTYPE.FORMULA_OLD:
                object _oValue = ((XlsBiffFormulaCell)cell).Value;
                if (!(_oValue is FORMULAERROR))
                {
                    m_cellsValues[cell.ColumnIndex] =
                        new XlsCell(_oValue);
                }
                else
                {
                    hasValue = false;
                }
                break;

            default:
                hasValue = false;
                break;
            }

            if (hasValue)
            {
                XlsBiffHyperLink hyperLink = m_globals.GetHyperLink(cell.RowIndex, cell.ColumnIndex);
                if (hyperLink != null)
                {
                    m_cellsValues[cell.ColumnIndex].SetHyperLink(hyperLink.Url);
                }
            }
        }