diff --git a/components/fpspreadsheet/source/common/fpsutils.pas b/components/fpspreadsheet/source/common/fpsutils.pas index bdaaf5fbb..5ad591a55 100644 --- a/components/fpspreadsheet/source/common/fpsutils.pas +++ b/components/fpspreadsheet/source/common/fpsutils.pas @@ -3185,7 +3185,8 @@ begin // Strip milliseconds? p := Pos('.', s); if (p > 1) then begin - ms := StrToFloat('0' + Copy(s, p, MaxInt), fs); + ms := StrToFloat('0' + Copy(s, p, MaxInt), fs) / SecsPerDay; + s := copy(s, 1, p-1); end else ms := 0; Result := StrToDateTime(s, fs) + ms; diff --git a/components/fpspreadsheet/source/common/xlsxooxml.pas b/components/fpspreadsheet/source/common/xlsxooxml.pas index 24fce1234..e36de0c4b 100644 --- a/components/fpspreadsheet/source/common/xlsxooxml.pas +++ b/components/fpspreadsheet/source/common/xlsxooxml.pas @@ -6144,12 +6144,12 @@ begin '%s', [s])); end; - if book.MetaData.LastModifiedBy = '' then - s := book.MetaData.CreatedBy - else + if book.MetaData.LastModifiedBy <> '' then + begin s := book.MetaData.LastModifiedBy; - AppendToStream(AStream, Format( + AppendToStream(AStream, Format( '%s', [s])); // to do: check xml entities + end; if book.MetaData.DateCreated > 0 then begin @@ -6159,13 +6159,13 @@ begin '%s', [s])); end; - if book.MetaData.DateLastModified <= 0 then - dt := book.MetaData.DateCreated + GetLocalTimeOffset / MinsPerDay - else + if book.MetaData.DateLastModified >0 then + begin dt := book.MetaData.DateLastModified + GetLocalTimeOffset / MinsPerDay; - s := FormatDateTime(ISO8601FormatExtendedUTC, dt); - AppendToStream(AStream, Format( + s := FormatDateTime(ISO8601FormatExtendedUTC, dt); + AppendToStream(AStream, Format( '%s', [s])); + end; AppendToStream(AStream, '');