Page 1 of 1

Formula is not being calculated in Excel

Posted: Mon Dec 01, 2014 2:30 pm
by ykarapinar
In the Excel file cell A1 must be the sum of A2:A5, but the result is 0 (zero).
And XLSReadWriteII51.Formulas.Calculate doesn't work.

Example code:

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  XLSReadWriteII51.FileName:='C:\XLSRW.xlsx';
  XLSReadWriteII51.Sheets[0].AsFormula[0, 0]:='SUM(A2:A5)';
  XLSReadWriteII51.Sheets[0].AsInteger[ 0, 1]:=1;
  XLSReadWriteII51.Sheets[0].AsInteger[ 0, 2]:=2;
  XLSReadWriteII51.Sheets[0].AsInteger[ 0, 3]:=3;
  XLSReadWriteII51.Sheets[0].AsInteger[ 0, 4]:=4;
  XLSReadWriteII51.Formulas.Calculate;
  XLSReadWriteII51.Write;
end;

Re: Formula is not being calculated in Excel

Posted: Fri Dec 05, 2014 8:59 am
by larsa
Hello

Use: XLSReadWriteII51.Calculate;