Date calculation issue

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
CareAll
Posts: 28
Joined: Mon Jun 24, 2013 9:30 am

Date calculation issue

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

Re: Date calculation issue

Post by larsa »

Hello

I could not reproduce this. Please send me an excel file with the formulas.
Lars Arvidsson, Axolot Data
CareAll
Posts: 28
Joined: Mon Jun 24, 2013 9:30 am

Re: Date calculation issue

Post by CareAll »

Hello Lars,

Sample files sent.
jsfkcz
Posts: 29
Joined: Thu Sep 11, 2014 8:29 am

Re: Date calculation issue

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

Re: Date calculation issue

Post by larsa »

Hello

This is fixed in update 5.20.44
Lars Arvidsson, Axolot Data
CareAll
Posts: 28
Joined: Mon Jun 24, 2013 9:30 am

Re: Date calculation issue

Post by CareAll »

Thank you
Post Reply