Page 1 of 1

Date calculation issue

Posted: Mon Mar 16, 2015 10:31 am
by CareAll
Hello,

I have a simple Excel input file containing data in the A1 and B1 cells.
A1 has a date value: November 26th, 2014
and there's a formula in B1: =DATE(YEAR(A1);MONTH(A1)+3;DAY(A1))
Here is my code:

Code: Select all

procedure TForm1.btn1Click(Sender: TObject);
var
  XLS: TXLSReadWriteII5;
begin
  XLS := TXLSReadWriteII5.Create(nil);
  try
    XLS.Filename := 'D:\input.xlsx';
    XLS.Read;

    XLS.Calculate;

    XLS.Filename := 'D:\output.xlsx';
    XLS.Version := xvExcel2007;
    XLS.Write;
  finally
    FreeAndNil(XLS);
  end;
end;
After executing this code, in B1 cell of the output file there is a value of Februar 26th, 2014 instead of Februar 26th, 2015.
Please investigate this error.
Thank you in advance.

Re: Date calculation issue

Posted: Mon Mar 16, 2015 4:32 pm
by larsa
Hello

I could not reproduce this. Please send me an excel file with the formulas.

Re: Date calculation issue

Posted: Mon Mar 16, 2015 6:39 pm
by CareAll
Hello Lars,

Sample files sent.

Re: Date calculation issue

Posted: Wed Mar 18, 2015 11:18 am
by jsfkcz
Hello,
I have the same problem with DATE function in my "template":

After writting new value of date to the cell "A1", there is wrong year in the result file. But after Ctr+Alt+F9 everything become OK.
Template
Image
Result
Image
(tested at 5.20.42)

The template and result are at http://www.genet.cz/kohout/xlsrw/xlsrw_date.zip for download.

Josef Kohout

Re: Date calculation issue

Posted: Thu Mar 19, 2015 9:23 am
by larsa
Hello

This is fixed in update 5.20.44

Re: Date calculation issue

Posted: Thu Mar 19, 2015 9:26 am
by CareAll
Thank you