OpenDocument4all - Info and tools about OpenDocument
Sunday, 05 February 2012
Home arrow Forum
Forum Statistics
Total user: 89
Total message: 179
Main Menu
Home
My Blog
AODL - Project
AODC - Project
OO Development & Info
Forum
About OpenDocument ...
Search
News
Contact Us
Login Form





Lost Password?
No account yet? Register
Sourceforge.net

SourceForge.net - Goto the project homepage
Project site on SF.net

 

Demand OpenDocument

 

Countomat Webcounter und Webstatistik (Statistik & Logfileanalyse, Counter)

OpenDocument4all-Forum

 
How to write date into spreadsheet cell properly?
Date: 2007/08/24 16:02 By: kichy Status: User  
Karma: 0  
Fresh Boarder

Posts: 2
graphgraph
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'...

I write strings this way:
private static void InsertStringAt(int RowIndex, int ColumnIndex, string Value, Table Table)
{
AODL.Document.Content.Tables.Cell cell = Table.CreateCell();
Paragraph paragraph = ParagraphBuilder.CreateSpreadsheetParagraph(Table.Document);
SimpleText simpletext = new SimpleText(Table.Document, Value);
paragraph.TextContent.Add(simpletext);
cell.Content.Add(paragraph);
cell.OfficeValueType = "string";
cell.OfficeValue = Value;
Table.InsertCellAt(RowIndex, ColumnIndex, cell);
}

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?

Thanks!
Rob
File Attachment:
File name: sample.zip
File size:9035 bytes


Post edited by: kichy, at: 2007/08/24 16:02
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
graphgraph
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.

Quick jump
Download area
Who's Online
We have 28 guests online
Polls
Should AODL and AODC also implement export as PDF and RTF?
 
Popular
© 2005 MamboZ. All rights reserved.