diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 27b93a3e7..1af762647 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -712,17 +712,26 @@ end; {******************************************************************* * TsSpreadOpenDocWriter.WriteDateTime () * -* DESCRIPTION: Writes a date/time value as a text -* ISO 8601 format is used to preserve interoperability -* between locales. +* DESCRIPTION: Writes a date/time value * -* Note: this should be replaced by writing actual date/time values * *******************************************************************} procedure TsSpreadOpenDocWriter.WriteDateTime(AStream: TStream; const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell); +var + lStyle: string = ''; + lIndex: Integer; begin - WriteLabel(AStream, ARow, ACol, FormatDateTime(ISO8601Format, AValue), ACell); + if ACell^.UsedFormattingFields <> [] then + begin + lIndex := FindFormattingInList(ACell); + lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" '; + end; + + // The row should already be the correct one + FContent := FContent + + ' ' + LineEnding + + ' ' + LineEnding; end; { diff --git a/components/fpspreadsheet/fpsutils.pas b/components/fpspreadsheet/fpsutils.pas index b82bc4669..d7b2ffe71 100644 --- a/components/fpspreadsheet/fpsutils.pas +++ b/components/fpspreadsheet/fpsutils.pas @@ -18,6 +18,8 @@ const // Date formatting string for unambiguous date/time display as strings // Can be used for text output when date/time cell support is not available ISO8601Format='yyyymmdd"T"hhmmss'; + // Extended ISO 8601 date/time format, used in e.g. ODF/opendocument + ISO8601FormatExtended='yyyy"-"mm"-"dd"T"hh":"mm":"ss'; // Endianess helper functions function WordToLE(AValue: Word): Word;