Hello,
I have a problem handle datetime values in aspose cells.
One of our application create export data in xml format.
That is how we define header and footer:
Dim l_sHeader : l_sHeader = “<?xml version=""1.0""?>” & vbLf _
& “<?mso-application progid=""Excel.Sheet""?>” & vbLf _
& “<Workbook xmlns=”“urn:schemas-microsoft-com:office:spreadsheet”" “ _
& “xmlns:o=”“urn:schemas-microsoft-com:office:office”” “ _
& “xmlns:x=”“urn:schemas-microsoft-com:office:excel”” “ _
& “xmlns:ss=”“urn:schemas-microsoft-com:office:spreadsheet”” “ _
& " <DocumentProperties xmlns=““urn:schemas-microsoft-com:office:office””>“ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” <ExcelWorkbook xmlns=““urn:schemas-microsoft-com:office:excel””>“ & vbLf _
& ” False“ & vbLf _
& ” False“ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” <Style ss:ID=““Default”” ss:Name=““Normal””>“ & vbLf _
& ” <Alignment ss:Vertical=““Bottom””/>“ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” <Style ss:ID=““Text””>“ & vbLf _
& ” <Alignment ss:Vertical=““Bottom”” ss:WrapText=““1"”/>” & vbLf _
& " “ & vbLf _
& ” <Style ss:ID=““Integer””>“ & vbLf _
& ” <NumberFormat ss:Format=““0"”/>” & vbLf _
& " “ & vbLf _
& ” <Style ss:ID=““Datetime””>“ & vbLf _
& ” <NumberFormat ss:Format=““d/m/yy\ h:mm;@””/>“ & vbLf _
& ” “ & vbLf _
& ” <Style ss:ID=““Date””>“ & vbLf _
& ” <NumberFormat ss:Format=““d/m/yy;@””/>“ & vbLf _
& ” “ & vbLf _
& ” <Style ss:ID=““Time””>“ & vbLf _
& ” <NumberFormat ss:Format=“”[$-F400]h:mm:ss\ AM/PM"“/>” & vbLf _
& " “ & vbLf _
& ” <Style ss:ID=““Float””>“ & vbLf _
& ” <NumberFormat ss:Format=““Fixed””/>“ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ” <Worksheet ss:Name=““Tabelle1"”>” & vbLf _
& " “ & vbLf
“ & vbLf _
Dim l_sFooter : l_sFooter = ”
& ” <WorksheetOptions xmlns=““urn:schemas-microsoft-com:office:excel””>“ & vbLf _
& ” “ & vbLf _
& ” “ & vbLf _
& ”" & vbLf
Then we write rows like this one:
<Row>
<Cell><Data ss:Type=“String”>Termin Test</Data></Cell>
<Cell><Data ss:Type=“String”>Standard</Data></Cell>
<Cell><Data ss:Type=“String”>Archer, Jonathan</Data></Cell>
<Cell ss:StyleID=“Datetime”><Data ss:Type=“DateTime”>2018-07-01T00:00:00.000</Data></Cell>
<Cell ss:StyleID=“Datetime”><Data ss:Type=“DateTime”>2018-07-02T00:00:00.000</Data></Cell>
<Cell><Data ss:Type=“String”>Archer, Jonathan</Data></Cell>
<Cell ss:StyleID=“Date”><Data ss:Type=“DateTime”>2016-11-16T00:00:00.000</Data></Cell>
</Row>
As you can see the date format is correct.
If we save the xml data to file and load it with original excel the date format in the example above will shown correct as July 1st and July 2nd.
Using Aspose.Cells component to load the file the example dates will mixed by month and day creating dates from January 7 to February 7.
I use a component based on Aspose.Cells. Inside the component Load/Save is just like this:
_workbook = new Workbook(source);
…
_workbook.Save(_path, SaveFormat.Xlsx);
Nothing special.
So it looks like the Aspose.Cells is not working with the correct format somehow.
Please help!