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;
if C.Visible then
begin
S:=C.Field.DisplayText;
if (C.KeyList.Count > 0) and (C.PickList.Count > 0) then
if Assigned(C.Field) then
begin
J := C.KeyList.IndexOf(S);
if (J >= 0) and (J < C.PickList.Count) then
S := C.PickList[j];
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S);
end
else
if Assigned(C.Field.OnGetText) then
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S)
else
if C.Field.DataType in [ftCurrency] then
FWorksheet.WriteCurrency(FCurRow, FCurCol, C.Field.AsCurrency, nfCurrency, '')
else
if C.Field.DataType in IntegerDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsInteger, nfFixed, 0)
else
if C.Field.DataType in NumericDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsFloat, nfFixed, 2)
else
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S);
S:=C.Field.DisplayText;
if (C.KeyList.Count > 0) and (C.PickList.Count > 0) then
begin
J := C.KeyList.IndexOf(S);
if (J >= 0) and (J < C.PickList.Count) then
S := C.PickList[j];
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S);
end
else
if Assigned(C.Field.OnGetText) then
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S)
else
if C.Field.DataType in [ftCurrency] then
FWorksheet.WriteCurrency(FCurRow, FCurCol, C.Field.AsCurrency, nfCurrency, '')
else
if C.Field.DataType in IntegerDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsInteger, nfFixed, 0)
else
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
begin