You've already forked lazarus-ccr
+ Initial write date/time cell support for opendocument/OpenOffice/Libreoffice
To do: adjust test suite for .ods files git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2867 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -712,17 +712,26 @@ end;
|
|||||||
{*******************************************************************
|
{*******************************************************************
|
||||||
* TsSpreadOpenDocWriter.WriteDateTime ()
|
* TsSpreadOpenDocWriter.WriteDateTime ()
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Writes a date/time value as a text
|
* DESCRIPTION: Writes a date/time value
|
||||||
* ISO 8601 format is used to preserve interoperability
|
|
||||||
* between locales.
|
|
||||||
*
|
*
|
||||||
* Note: this should be replaced by writing actual date/time values
|
|
||||||
*
|
*
|
||||||
*******************************************************************}
|
*******************************************************************}
|
||||||
procedure TsSpreadOpenDocWriter.WriteDateTime(AStream: TStream;
|
procedure TsSpreadOpenDocWriter.WriteDateTime(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell);
|
const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell);
|
||||||
|
var
|
||||||
|
lStyle: string = '';
|
||||||
|
lIndex: Integer;
|
||||||
begin
|
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 +
|
||||||
|
' <table:table-cell office:value-type="date" office:date-value="' + FormatDateTime(ISO8601FormatExtended, AValue) + '"' + lStyle + '>' + LineEnding +
|
||||||
|
' </table:table-cell>' + LineEnding;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,8 @@ const
|
|||||||
// Date formatting string for unambiguous date/time display as strings
|
// Date formatting string for unambiguous date/time display as strings
|
||||||
// Can be used for text output when date/time cell support is not available
|
// Can be used for text output when date/time cell support is not available
|
||||||
ISO8601Format='yyyymmdd"T"hhmmss';
|
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
|
// Endianess helper functions
|
||||||
function WordToLE(AValue: Word): Word;
|
function WordToLE(AValue: Word): Word;
|
||||||
|
Reference in New Issue
Block a user