fpspreadsheet: Fix meta data reading error of some ods files. Avoid display of metadata zero dates in Excel.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7583 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-07-28 21:30:12 +00:00
parent c902c41997
commit 25d59b8e88
2 changed files with 11 additions and 10 deletions

View File

@ -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;

View File

@ -6144,12 +6144,12 @@ begin
'<dc:description>%s</dc:description>', [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(
'<cp:lastModifiedBy>%s</cp:lastModifiedBy>', [s])); // to do: check xml entities
end;
if book.MetaData.DateCreated > 0 then
begin
@ -6159,13 +6159,13 @@ begin
'<dcterms:created xsi:type="dcterms:W3CDTF">%s</dcterms:created>', [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(
'<dcterms:modified xsi:type="dcterms:W3CDTF">%s</dcterms:modified>', [s]));
end;
AppendToStream(AStream,
'</cp:coreProperties>');