Formula is not being calculated in Excel

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
ykarapinar
Posts: 22
Joined: Fri May 17, 2013 7:59 am

Formula is not being calculated in Excel

Post 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;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Formula is not being calculated in Excel

Post by larsa »

Hello

Use: XLSReadWriteII51.Calculate;
Lars Arvidsson, Axolot Data
Post Reply