fpspreadsheet: Patch from bug 21400, adds date reading support to the ods reader

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2599 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2012-12-11 16:46:25 +00:00
parent 97df6a8d20
commit ca0980e0ed

View File

@ -49,6 +49,7 @@ type
procedure ReadFormula(ARow : Word; ACol : Word; ACellNode: TDOMNode);
procedure ReadLabel(ARow : Word; ACol : Word; ACellNode: TDOMNode);
procedure ReadNumber(ARow : Word; ACol : Word; ACellNode: TDOMNode);
procedure ReadDate(ARow : Word; ACol : Word; ACellNode: TDOMNode);
end;
{ TsSpreadOpenDocWriter }
@ -214,7 +215,9 @@ begin
else if ParamFormula<>'' then
ReadFormula(Row+RowsCount,Col+ColsCount,CellNode)
else if ParamValueType='float' then
ReadNumber(Row+RowsCount,Col+ColsCount,CellNode);
ReadNumber(Row+RowsCount,Col+ColsCount,CellNode)
else if ParamValueType='date' then
ReadDate(Row+RowsCount,Col+ColsCount,CellNode);
end; //for ColsCount
end; //for RowsCount
@ -265,6 +268,16 @@ begin
end;
end;
procedure TsSpreadOpenDocReader.ReadDate(ARow: Word; ACol : Word; ACellNode : TDOMNode);
var
Value: String;
dt:TDateTime;
begin
Value:=GetAttrValue(ACellNode,'office:date-value');
dt:=StrToDate(Value,'yyyy-mm-dd','-');
FWorkSheet.WriteDateTime(Arow,ACol,dt);
end;
{ TsSpreadOpenDocWriter }
procedure TsSpreadOpenDocWriter.WriteMimetype;