We need some guidance on how to fix the problem that we have with date years that are prior to 2000. If we take for example this date: 12/03/98, and we insert it into Aspose Worksheet using cell.PutValue(“12/03/98”, true, true), with format =“d/mm/yyyy” instead of having 12/03/1998 we have 12/03/98 (and when we select the cell we have 12/03/2098)
Here is the code that we are using to reproduce the problem:
Aspose version: 16.10.0.0;
using System;
using Aspose.Cells;
namespace Reproducer
{
public class Program
{
public static void Main(string[] args)
{
PutDateValue();
}
public static void PutDateValue()
{
var testDateValue = “12/03/98”;
const string customFormat = “m/dd/yyy”;
var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];
var cell = worksheet.Cells[0, 0];
/*
* This should output 12/03/1998 but it outputs in
* Excel 12/03/98 ( and when you select the cell it shows 12/3/2098
/
cell.PutValue(testDateValue, true, true);
var style = cell.GetStyle();
style.SetCustom(customFormat, false);
cell = worksheet.Cells[0, 1];
var date = DateTime.Parse(testDateValue);
/
* This should output 12/03/1998 but it outputs in
* Excel 0/03/1998
*/
cell.PutValue(date.ToString(customFormat), true, true);
workbook.Save(“date.xlsx”);
}
}
}
We need guidance ASAP on how to fix the problem and to make sure dates, appear as we are expecting them to appear.