Saving a custom date property results in wrong time written

Hi, I noticed that when I save a custom DateTime property to an excel spreadsheet, the wrong value is saved. When I read the value again I get the incorrect time (it’s off by 4 hours). See test code below… similar code works ok for Aspose.Words.

Thanks

    public void PropertyTest()
    {
        const string propertyName = "CustomDate";
        var workbook = new Workbook("TestWithProperties.xlsx");
        workbook.CustomDocumentProperties.Add(propertyName, new DateTime(2010, 8, 30, 16, 26, 17, DateTimeKind.Local));
        workbook.Save("TestWithPropertiesAfter.xlsx");

        var workbookAfter = new Workbook("TestWithPropertiesAfter.xlsx");
        Console.WriteLine($@"Before: {(DateTime)workbook.CustomDocumentProperties[propertyName].Value}");
        Console.WriteLine($@"After: {(DateTime)workbookAfter.CustomDocumentProperties[propertyName].Value}");

        /* Before: 8/30/2010 4:26:17 PM
           After: 8/30/2010 12:26:17 PM */
    }

@mdesousa75,

Thanks for the sample code with details.

After an initial test, I observed the issue as you mentioned by using your sample code with my simple template file. I found that by saving a custom date property results in wrong time written. I get the time which is off by 5 hours or so here:
e.g
Sample code:

    const string propertyName = "CustomDate"; 
    var workbook = new Workbook("e:\\test2\\Book1.xlsx");//I use a simple template file. 
    workbook.CustomDocumentProperties.Add(propertyName, new DateTime(2010, 8, 30, 16, 26, 17, DateTimeKind.Local)); 
    workbook.Save("e:\\test2\\out1TestWithPropertiesAfter1.xlsx"); 
    var workbookAfter = new Workbook("e:\\test2\\out1TestWithPropertiesAfter1.xlsx"); 
    Console.WriteLine("Before: " + Convert.ToDateTime(workbook.CustomDocumentProperties[propertyName].Value)); 
    Console.WriteLine("After: " + Convert.ToDateTime(workbookAfter.CustomDocumentProperties[propertyName].Value)); 

Output:
Before: 30/8/2010 4:26:17 PM
After: 30/8/2010 9:26:17 PM

I have logged a ticket with an id “CELLSNET-45624” for your issue. We will check if this is expected behavior or an issue.

Once we have an update on it or we figure it out, we will let you know here.

@mdesousa75,

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-45624”). We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@mdesousa75

Please download and try the following fix and let us know your feedback.

Thanks! I normally get newer versions from Nuget… and I don’t see this version there. Is it going to be published soon?

@mdesousa75,

Well, you may use this fix as an official release, it contans all the features full fledged with fixes and enhancements. We only publish official releases (from Downloads section) on Nuget repository, the v17.8 is the latest version which is also published on Nuget repos. We will publish the next official release v17.9 when it is released in Downloads module in the mid of this month (September 2017) or so.

The issues you have found earlier (filed as CELLSNET-45624) have been fixed in Aspose.Cells for .NET 17.9.