Hi there, I'm developing a new function for one of my projects which will write the contents of a DataTable into an ODS file. I succesfully write strings and numbers into the document, but I have problems with dates. Regardless of what date value I try to write into the cell (for example '2007-08-23'), there is always one date appears: '1905-06-29 00:00:00'...
and date this way: private static void InsertDateTimeAt(int RowIndex, int ColumnIndex, DateTime Value, Table Table) { AODL.Document.Content.Tables.Cell cell = Table.CreateCell(); Paragraph paragraph = ParagraphBuilder.CreateSpreadsheetParagraph(Table.Document); SimpleText simpletext = new SimpleText(Table.Document, GetStringFromDate(Value)); paragraph.TextContent.Add(simpletext); cell.Content.Add(paragraph); cell.OfficeValueType = "date"; cell.OfficeValue = DateTimeConverter.GetStringFromDateTime(Value); Table.InsertCellAt(RowIndex, ColumnIndex, cell); } I attached a sample spreadsheet I produce this way. Any suggestions how to resolve this issue?
The administrator has disabled public write access.
Re:How to write date into spreadsheet cell properly?
Date: 2007/08/29 01:48
By: kichy
Status: User
Karma: 0  
Fresh Boarder
Posts: 2
Hi again, I think I found a possible solution but it needs modifying the source. I found a patch at this link: http://odftoolkit.openoffice.org/servlets/ReadMsg?list=dev&msgNo=337 Too bad it's not in CVS version. This way i can write cell value like a datetime: ... cell.OfficeDateValue = DateTimeConverter.GetStringFromDateTime(Value); ...
Offtopic: This forum seems quite neglected. The CVS state also seems rather old. This patch (thanx God i found it) seems important, its more than 1 month old and CVS still ignores it. Like no one wants to develop AODL anymore... Should we look for another fileformat to handle our datas? /Offtopic
Bye
The administrator has disabled public write access.