XLSRWII5: Calculate seems not working properly (5.20.32)
Posted: Thu Sep 11, 2014 9:10 am
Hello,
I have 2 formulas in my "template.xlsx":
1. Cell B5 has a formula = TARGET * 100
2. Cell B6 has a formula = A3 * 100
and
Cell A3 is a named cell "TARGET" (its default value is blank).
When I write integer value 10 to the cell A3 by XLSRW and open the result file, the cell B5 value is stil zero and the cell B6 value is ok = 1000 . The formula with named cell was not calculated properly.
If I press Ctrl+Alt+F9 manually, the value of cell B5 will become ok.
(
The calculation is set "automatically" all the time.
I created my template.xlsx in Excel 2013 and I tested it with Excel 2007 and 2010 too. The behavior is the same.
I tested it at the last version of XLSRWII5 - 5.20.32
)
For this sample I used this code:
The template.xlsx and result.xlsx are at http://www.genet.cz/kohout/xlsrw/exampl ... culate.zip for download.
Josef Kohout
I have 2 formulas in my "template.xlsx":
1. Cell B5 has a formula = TARGET * 100
2. Cell B6 has a formula = A3 * 100
and
Cell A3 is a named cell "TARGET" (its default value is blank).
When I write integer value 10 to the cell A3 by XLSRW and open the result file, the cell B5 value is stil zero and the cell B6 value is ok = 1000 . The formula with named cell was not calculated properly.
If I press Ctrl+Alt+F9 manually, the value of cell B5 will become ok.
(
The calculation is set "automatically" all the time.
I created my template.xlsx in Excel 2013 and I tested it with Excel 2007 and 2010 too. The behavior is the same.
I tested it at the last version of XLSRWII5 - 5.20.32
)
For this sample I used this code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
const
cOrigFile = 'template.xlsx';
cTestFile = 'result.xlsx';
var
ASheet: TXLSWorksheet;
begin
CopyFile(cOrigFile,cTestFile,False);
xlsRW.Filename:= cTestFile;
xlsRW.Read;
ASheet:= xlsRW.SheetByName('DATA');
asheet.asinteger[0,2]:=10; // cell A3
xlsRW.calculate;
xlsRW.Write;
end;
end.
Josef Kohout