Free Support Forum - aspose.com

A method to let you increase with a calculation type for one day on the day that you demanded by a DATE function

Hello.

I asked you a question the other day, but let me ask you a question once again because there was not an answer.

It is one step more, but I want to increase only 1st on the date that I led by a DATE function, but do not work by this program.
Will there be measures method?

Excel excel = new Excel();
excel.Open(@"C:\TEMP.XLS");
Worksheet sheet = excel.Worksheets[0];
DateTime dt = new DateTime(2005,12,24);
sheet.Cells[1,1].PutValue(dt);
sheet.Cells[0,0].Formula = "=YEAR(B2)";
sheet.Cells[0,1].Formula = "=MONTH(B2)";
sheet.Cells[0,2].Formula = "=DAY(B2)";

sheet.Cells[1,0].Formula = "=DATE(A1,B1,C1)";
sheet.Cells[1,2].Formula = "=B1+1";

excel.CalculateFormula();

Console.WriteLine(sheet.Cells[1,0].StringValue);
Console.WriteLine(sheet.Cells[1,2].StringValue);

The output on the console is:

2005/12/24 0:00:00
#VALUE!


Why will not it be output as follows?
2005/12/24 0:00:00
2005/12/25 0:00:00


daimaru(japan)
I translate this sentence by translation software

I am working this this issue and I will complete this fix at the start of next week.

Thank you for coping at once.
I expect it.

Please try this attached fix with the following sample code:

Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];
DateTime dt = new DateTime(2005,12,24);
sheet.Cells[1,1].PutValue(dt);
sheet.Cells[0,0].Formula = "=YEAR(B2)";
sheet.Cells[0,1].Formula = "=MONTH(B2)";
sheet.Cells[0,2].Formula = "=DAY(B2)";

sheet.Cells[1,0].Formula = "=DATE(A1,B1,C1)";
sheet.Cells[1,2].Formula = "=A2+1";

sheet.Cells[1,2].Style.Number = 22;

excel.CalculateFormula();

Console.WriteLine(sheet.Cells[1,0].StringValue);
Console.WriteLine(sheet.Cells[1,2].StringValue);