/** * @return <c>true</c> if (rowIx, colIx) is within the range ({@link #Range}) * of this shared value object. */ public bool IsInRange(int rowIx, int colIx) { CellRangeAddress8Bit r = _range; return(r.FirstRow <= rowIx && r.LastRow >= rowIx && r.FirstColumn <= colIx && r.LastColumn >= colIx); }
/// <summary> /// Constructs a Selection record and Sets its fields appropriately. /// </summary> /// <param name="in1">the RecordInputstream to Read the record from</param> public SelectionRecord(RecordInputStream in1) { field_1_pane = (byte)in1.ReadByte(); field_2_row_active_cell = in1.ReadUShort(); field_3_col_active_cell = in1.ReadShort(); field_4_ref_active_cell = in1.ReadShort(); int field_5_num_refs = in1.ReadUShort(); field_6_refs = new CellRangeAddress8Bit[field_5_num_refs]; for (int i = 0; i < field_5_num_refs; i++) { field_6_refs[i] = new CellRangeAddress8Bit(in1); } }
public void TestLoad() { TableRecord record = new TableRecord(TestcaseRecordInputStream.Create(0x236, data)); CellRangeAddress8Bit range = record.Range; Assert.AreEqual(3, range.FirstRow); Assert.AreEqual(8, range.LastRow); Assert.AreEqual(4, range.FirstColumn); Assert.AreEqual(6, range.LastColumn); Assert.AreEqual(0, record.Flags); Assert.AreEqual(4, record.RowInputRow); Assert.AreEqual(1, record.ColInputRow); Assert.AreEqual(0x4076, record.RowInputCol); Assert.AreEqual(0, record.ColInputCol); Assert.AreEqual(16 + 4, record.RecordSize); }
//hacked to provide one cell reference to 0,0 - 0,0 public override int Serialize(int offset, byte [] data) { LittleEndian.PutUShort(data, 0 + offset, sid); LittleEndian.PutUShort(data, 2 + offset, this.DataSize); LittleEndian.PutByte(data, 4 + offset, this.Pane); LittleEndian.PutUShort(data, 5 + offset, this.ActiveCellRow); LittleEndian.PutUShort(data, 7 + offset, this.ActiveCellCol); LittleEndian.PutUShort(data, 9 + offset, this.ActiveCellRef); LittleEndian.PutUShort(data, 11 + offset, field_6_refs.Length); for (int i = 0; i < field_6_refs.Length; i++) { CellRangeAddress8Bit r = field_6_refs[i]; r.Serialize(offset + 13 + i * CellRangeAddress8Bit.ENCODED_SIZE, data); } return(4 + DataSize); }
public override int Compare(SharedFormulaGroup a, SharedFormulaGroup b) { CellRangeAddress8Bit rangeA = a.SFR.Range; CellRangeAddress8Bit rangeB = b.SFR.Range; int cmp; cmp = rangeA.FirstRow - rangeB.FirstRow; if (cmp != 0) { return(cmp); } cmp = rangeA.FirstColumn - rangeB.FirstColumn; if (cmp != 0) { return(cmp); } return(0); }
public CellRangeAddress GetArrayFormulaRange() { if (_sharedFormulaRecord != null) { throw new InvalidOperationException("not an array formula cell."); } CellReference expRef = _formulaRecord.Formula.ExpReference; if (expRef == null) { throw new InvalidOperationException("not an array formula cell."); } ArrayRecord arec = _sharedValueManager.GetArrayRecord(expRef.Row, expRef.Col); if (arec == null) { throw new InvalidOperationException("ArrayRecord was not found for the locator " + expRef.FormatAsString()); } CellRangeAddress8Bit a = arec.Range; return(new CellRangeAddress(a.FirstRow, a.LastRow, a.FirstColumn, a.LastColumn)); }
public void TestStore() { // Offset 0x3bd9 (15321) // recordid = 0x236, size = 16 // [TABLE] // .row from = 3 // .row to = 8 // .column from = 4 // .column to = 6 // .flags = 0 // .always calc =false // .reserved = 0 // .row input row = 4 // .col input row = 1 // .row input col = 4076 // .col input col = 0 // [/TABLE] CellRangeAddress8Bit crab = new CellRangeAddress8Bit(3, 8, 4, 6); TableRecord record = new TableRecord(crab); record.Flags = (/*setter*/(byte)0); record.RowInputRow = (/*setter*/4); record.ColInputRow = (/*setter*/1); record.RowInputCol = (/*setter*/0x4076); record.ColInputCol = (/*setter*/0); byte[] recordBytes = record.Serialize(); Assert.AreEqual(recordBytes.Length - 4, data.Length); for (int i = 0; i < data.Length; i++) Assert.AreEqual(data[i], recordBytes[i + 4], "At offset " + i); }
public ArrayRecord(Npoi.Core.SS.Formula.Formula formula, CellRangeAddress8Bit range) : base(range) { _options = 0; //YK: Excel 2007 leaves this field unset _field3notUsed = 0; _formula = formula; }
public TableRecord(CellRangeAddress8Bit range) : base(range) { field_6_res = 0; }
/** * @return <c>true</c> if (rowIx, colIx) describes the first cell in this shared value * object's range ({@link #Range}) */ public bool IsFirstCell(int rowIx, int colIx) { CellRangeAddress8Bit r = Range; return(r.FirstRow == rowIx && r.FirstColumn == colIx); }
private SharedFormulaRecord(CellRangeAddress8Bit range) : base(range) { field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY); }
/** * reads only the range (1 {@link CellRangeAddress8Bit}) from the stream */ public SharedValueRecordBase(RecordInputStream in1) { _range = new CellRangeAddress8Bit(in1); }
protected SharedValueRecordBase(CellRangeAddress8Bit range) { _range = range; }
public ArrayRecord(LF.Utils.NPOI.SS.Formula.Formula formula, CellRangeAddress8Bit range):base(range) { _options = 0; //YK: Excel 2007 leaves this field unset _field3notUsed = 0; _formula = formula; }
private SharedFormulaRecord(CellRangeAddress8Bit range): base(range) { field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY); }