diff --git a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi index b433c01a4..e40b049ad 100644 --- a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi +++ b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi @@ -38,7 +38,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -59,19 +59,18 @@ - + - - + @@ -80,11 +79,11 @@ - + - + @@ -129,144 +128,155 @@ - + - + - + - + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - + + + + + + + + - + - + - - + + diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 1af762647..26d01ff4b 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -275,11 +275,25 @@ end; procedure TsSpreadOpenDocReader.ReadDate(ARow: Word; ACol : Word; ACellNode : TDOMNode); var - Value: String; dt:TDateTime; + Value: String; + Fmt : TFormatSettings; + PointPos : integer; begin + // Format expects ISO 8601 type date string + fmt.ShortDateFormat:='yyyy-mm-dd'; + fmt.DateSeparator:='-'; + fmt.LongTimeFormat:='hh:nn:ss'; + fmt.TimeSeparator:=':'; Value:=GetAttrValue(ACellNode,'office:date-value'); - dt:=StrToDate(Value,'yyyy-mm-dd','-'); + Value:=StringReplace(Value,'T',' ',[rfIgnoreCase,rfReplaceAll]); + // Strip milliseconds? + PointPos:=Pos('.',Value); + if (PointPos>1) then + begin + Value:=Copy(Value,1,PointPos-1); + end; + dt:=StrToDateTime(Value,Fmt); FWorkSheet.WriteDateTime(Arow,ACol,dt); end;