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; }
private static Bytes ROW(Row row) { Bytes bytes = new Bytes(); //Index of this row bytes.Append(BitConverter.GetBytes((ushort)(row.RowIndex - 1))); //Index to column of the first cell which is described by a cell record bytes.Append(BitConverter.GetBytes((ushort)(row.MinCellCol - 1))); //Index to column of the last cell which is described by a cell record, + 1 bytes.Append(BitConverter.GetBytes(row.MaxCellCol)); //Height of row in twips, custom row height indicator //TODO: Implement Row height and custom height indicators (excelfileformat.pdf p.190) bytes.Append(new byte[] {0x08, 0x01}); //Not used bytes.Append(new byte[] {0x00, 0x00}); //Not used anymore in BIFF8 (DBCELL instead) bytes.Append(new byte[] {0x00, 0x00}); //Option flags and default row formatting //TODO: Implement Row option flags and default row formatting (excelfileformat.pdf p.190) bytes.Append(new byte[] {0x00, 0x01, 0x0F, 0x00}); return Record.GetBytes(RID.ROW, bytes); }