RxFPC:RxDBGrid - fix export data to spreadsheet

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4117 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2015-05-06 06:31:21 +00:00
parent 12d3dae6ed
commit 98916ce6c7
2 changed files with 18 additions and 4 deletions

View File

@ -39,7 +39,7 @@ uses
LCLType, LCLIntf, Registry, Classes, SysUtils, DB, IniFiles;
const
IntegerDataTypes = [ftSmallint, ftInteger, ftWord, ftLargeint];
IntegerDataTypes = [ftSmallint, ftInteger, ftWord, ftLargeint, ftAutoInc];
NumericDataTypes = IntegerDataTypes + [ftFloat, ftCurrency, ftBCD];

View File

@ -84,7 +84,7 @@ procedure Register;
implementation
uses fpsallformats, LCLType, Forms, math, LazUTF8, rxdconst, Controls, LCLIntf,
RxDBGridExportSpreadSheet_ParamsUnit;
RxDBGridExportSpreadSheet_ParamsUnit, dbutils;
{$R rxdbgridexportspreadsheet.res}
@ -238,7 +238,21 @@ begin
J := C.KeyList.IndexOf(S);
if (J >= 0) and (J < C.PickList.Count) then
S := C.PickList[j];
end;
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);
if ressExportColors in FOptions then