AdjustRangeAddress(Address: String, SourceCell: ITabRange, DestinationCell: ITabRange): String;
Address — the cell range address, which should be corrected.
SourceCell — the source cell during correction.
DestinationCell — the destination cell during correction.
The AdjustRangeAddress method adjusts the relative cell range address during moving a formula.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Tab: ITabSheet;
Begin
Tab := UiTabSheet1.TabSheet;
Tab.Cell(0, 0).Value := 10;
Tab.Cell(0, 1).Value := 20;
Tab.Cell(0, 2).Value := 30;
Tab.Cell(0, 3).Value := 40;
Tab.Cell(1, 0).Formula := "= Sum(a0: c0)";
Tab.Cell(1, 1).Formula := "= Sum(" + Tab.AdjustRangeAddress("A0:C0", Tab.Cell(1, 0), Tab.Cell(1, 1)) + ")";
End Sub Button1OnClick;
As a result for the cell "A1" will be set a formula, adding up the values of cells in the range "A0:C0". After this the formula will be corrected for the cell "B1".
See also: