Beispiel #1
0
        private Row GetBlockRow(ushort rbIdx, ushort brIdx)
        {
            Row blockRow = new Row();

            ushort j    = 0;
            ushort row1 = (ushort)(_worksheet.Rows.MinRow + ((rbIdx - 1) * 32));

            CachedBlockRow cachedBlockRow = _worksheet.CachedBlockRow;

            ushort rowMin = row1;
            ushort rowMax = (ushort)(rowMin + 31);

            if (cachedBlockRow.RowBlockIndex == rbIdx)
            {
                if (cachedBlockRow.BlockRowIndex == brIdx)
                {
                    return(cachedBlockRow.Row);
                }
                else if (brIdx < cachedBlockRow.BlockRowIndex)
                {
                    //NOTE: !!! Is this right? vba said ".Row.Row" !!!
                    rowMax = cachedBlockRow.Row.RowIndex;
                }
                else if (brIdx > cachedBlockRow.BlockRowIndex)
                {
                    if (cachedBlockRow.RowBlockIndex > 0)
                    {
                        rowMin = (ushort)(cachedBlockRow.Row.RowIndex + 1);
                        j      = cachedBlockRow.BlockRowIndex;
                    }
                    else
                    {
                        rowMin = 1;
                    }
                }
            }

            for (ushort i = rowMin; i <= rowMax; i++)
            {
                if (_worksheet.Rows.RowExists(i))
                {
                    j++;
                    if (j == brIdx)
                    {
                        blockRow = _worksheet.Rows[i];
                        _worksheet.CachedBlockRow = new CachedBlockRow(rbIdx, brIdx, blockRow);
                    }
                }
            }

            return(blockRow);
        }
Beispiel #2
0
        internal Worksheet(XlsDocument doc)
        {
            _doc = doc;

            _visibility       = WorksheetVisibilities.Default;
            _sheettype        = WorksheetTypes.Default;
            _streamByteLength = 0;

            _dbCellOffsets = new int[0];

            _cells     = new Cells(this);
            _rows      = new Rows();
            _rowBlocks = new RowBlocks(this);

            _cachedBlockRow = CachedBlockRow.Empty;

            _columnInfos = new List <ColumnInfo>();
        }