RxFPC:fix export from RxDBGrid to Spreadsheet data with collumn.field=nil

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4550 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2016-03-14 06:28:04 +00:00
parent da0eddc8e4
commit ca00c9c90c

View File

@ -241,29 +241,31 @@ begin
CT:=C.Title as TRxColumnTitle; CT:=C.Title as TRxColumnTitle;
if C.Visible then if C.Visible then
begin begin
if Assigned(C.Field) then
S:=C.Field.DisplayText;
if (C.KeyList.Count > 0) and (C.PickList.Count > 0) then
begin begin
J := C.KeyList.IndexOf(S); S:=C.Field.DisplayText;
if (J >= 0) and (J < C.PickList.Count) then if (C.KeyList.Count > 0) and (C.PickList.Count > 0) then
S := C.PickList[j]; begin
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S); J := C.KeyList.IndexOf(S);
end if (J >= 0) and (J < C.PickList.Count) then
else S := C.PickList[j];
if Assigned(C.Field.OnGetText) then FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S);
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S) end
else else
if C.Field.DataType in [ftCurrency] then if Assigned(C.Field.OnGetText) then
FWorksheet.WriteCurrency(FCurRow, FCurCol, C.Field.AsCurrency, nfCurrency, '') FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S)
else else
if C.Field.DataType in IntegerDataTypes then if C.Field.DataType in [ftCurrency] then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsInteger, nfFixed, 0) FWorksheet.WriteCurrency(FCurRow, FCurCol, C.Field.AsCurrency, nfCurrency, '')
else else
if C.Field.DataType in NumericDataTypes then if C.Field.DataType in IntegerDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsFloat, nfFixed, 2) FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsInteger, nfFixed, 0)
else else
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S); if C.Field.DataType in NumericDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsFloat, nfFixed, 2)
else
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S);
end;
if ressExportColors in FOptions then if ressExportColors in FOptions then
begin begin