EnableFormulas: Boolean;
EnableFormulas: boolean;
The EnableFormulas property determines whether formulas are calculated in cells.
Available values:
True. Formulas are calculated in cells.
False. Formulas are not calculated in cells.
To execute the example a regular report with the Reg_rep identifier is required.
Add links to the Metabase, Report and Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Rep: IPrxReport;
Tab: ITabSheet;
Sheet: IPrxTable;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("Reg_rep").Edit;
Rep := MObj As IPrxReport;
Sheet := Rep.Sheets.Item(0) As IPrxTable;
Tab := Sheet.TabSheet;
Tab.Cell(0, 0).Value := 10;
Tab.Cell(0, 1).Value := 20;
Tab.Cell(0, 2).Value := 30;
Tab.EnableFormulas := True;
Tab.Cell(1, 0).Formula := "=A0+B0";
Tab.Cell(1, 1).Formula := Tab.AdjustFormula(Tab.Cell(1, 0).Formula, Tab.Cell(1, 0), Tab.Cell(1, 1));
MObj.Save;
End Sub UserProc;
After executing the example the formula that sums values of the A0 and B0 cells is set for the A1 cell. Then this formula is corrected for the B1 cell.
The requirements and result of Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Rep: IPrxReport;
Tab: ITabSheet;
Sheet: IPrxTable;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["Reg_rep"].Edit();
Rep := MObj As IPrxReport;
Sheet := Rep.Sheets.Item[0] As IPrxTable;
Tab := Sheet.TabSheet;
Tab.Cell[0, 0].Value := 10;
Tab.Cell[0, 1].Value := 20;
Tab.Cell[0, 2].Value := 30;
Tab.EnableFormulas := True;
Tab.Cell[1, 0].Formula := "=A0+B0";
Tab.Cell[1, 1].Formula := Tab.AdjustFormula(Tab.Cell[1, 0].Formula, Tab.Cell[1, 0], Tab.Cell[1, 1]);
MObj.Save();
End Sub;
See also: