|
@@ -69,12 +69,14 @@ Type
|
|
FCurrencySymbol : String;
|
|
FCurrencySymbol : String;
|
|
FDateFormat : String;
|
|
FDateFormat : String;
|
|
FIntegerFormat: String;
|
|
FIntegerFormat: String;
|
|
|
|
+ FHandleNullField: Boolean;
|
|
FTimeFormat : String;
|
|
FTimeFormat : String;
|
|
FDateTimeFormat : String;
|
|
FDateTimeFormat : String;
|
|
FDecimalSeparator: Char;
|
|
FDecimalSeparator: Char;
|
|
FUseDisplayText : Boolean;
|
|
FUseDisplayText : Boolean;
|
|
Protected
|
|
Protected
|
|
Procedure InitSettings; virtual;
|
|
Procedure InitSettings; virtual;
|
|
|
|
+ Property HandleNullField : Boolean Read FHandleNullField Write FHandleNullField;
|
|
Property UseDisplayText : Boolean Read FUseDisplayText Write FUseDisplayText;
|
|
Property UseDisplayText : Boolean Read FUseDisplayText Write FUseDisplayText;
|
|
Property IntegerFormat : String Read FIntegerFormat Write FIntegerFormat;
|
|
Property IntegerFormat : String Read FIntegerFormat Write FIntegerFormat;
|
|
Property DecimalSeparator : Char Read FDecimalSeparator Write FDecimalSeparator;
|
|
Property DecimalSeparator : Char Read FDecimalSeparator Write FDecimalSeparator;
|
|
@@ -295,6 +297,7 @@ Procedure UnRegisterExportFormat(Const AName : String);
|
|
Const
|
|
Const
|
|
StringFieldTypes = [ftString,ftFixedChar,ftWidestring,ftFixedWideChar];
|
|
StringFieldTypes = [ftString,ftFixedChar,ftWidestring,ftFixedWideChar];
|
|
IntFieldTypes = [ftInteger,ftWord,ftSmallint,ftAutoinc];
|
|
IntFieldTypes = [ftInteger,ftWord,ftSmallint,ftAutoinc];
|
|
|
|
+ FloatFieldTypes = [ftFloat, ftCurrency, ftFMTBcd, ftBCD];
|
|
OrdFieldTypes = IntFieldTypes +[ftBoolean,ftLargeInt];
|
|
OrdFieldTypes = IntFieldTypes +[ftBoolean,ftLargeInt];
|
|
DateFieldTypes = [ftDate,ftTime,ftDateTime,ftTimeStamp];
|
|
DateFieldTypes = [ftDate,ftTime,ftDateTime,ftTimeStamp];
|
|
MemoFieldTypes = [ftMemo,ftFmtMemo,ftWideMemo];
|
|
MemoFieldTypes = [ftMemo,ftFmtMemo,ftWideMemo];
|
|
@@ -587,9 +590,11 @@ Var
|
|
FS : TFormatSettings;
|
|
FS : TFormatSettings;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ if F.IsNull and FormatSettings.HandleNullField then
|
|
|
|
+ Exit('');
|
|
If (F.DataType in IntFieldTypes) then
|
|
If (F.DataType in IntFieldTypes) then
|
|
begin
|
|
begin
|
|
- If (FormatSettings.IntegerFormat)<>'' then
|
|
|
|
|
|
+ If ((FormatSettings.IntegerFormat)<>'') and (not F.IsNull) then
|
|
Result:=Format(FormatSettings.IntegerFormat,[F.AsInteger])
|
|
Result:=Format(FormatSettings.IntegerFormat,[F.AsInteger])
|
|
else if FormatSettings.UseDisplayText then
|
|
else if FormatSettings.UseDisplayText then
|
|
Result:=F.DisplayText
|
|
Result:=F.DisplayText
|
|
@@ -598,10 +603,11 @@ begin
|
|
end
|
|
end
|
|
else if (F.DataType=ftBoolean) then
|
|
else if (F.DataType=ftBoolean) then
|
|
begin
|
|
begin
|
|
- If F.AsBoolean then
|
|
|
|
- Result:=FormatSettings.BooleanTrue
|
|
|
|
- else
|
|
|
|
- Result:=FormatSettings.BooleanFalse;
|
|
|
|
|
|
+ if (Not F.IsNull) then
|
|
|
|
+ If F.AsBoolean then
|
|
|
|
+ Result:=FormatSettings.BooleanTrue
|
|
|
|
+ else
|
|
|
|
+ Result:=FormatSettings.BooleanFalse;
|
|
If (Result='') then
|
|
If (Result='') then
|
|
if FormatSettings.UseDisplayText then
|
|
if FormatSettings.UseDisplayText then
|
|
Result:=F.DisplayText
|
|
Result:=F.DisplayText
|
|
@@ -610,7 +616,7 @@ begin
|
|
end
|
|
end
|
|
else if (F.DataType=ftDate) then
|
|
else if (F.DataType=ftDate) then
|
|
begin
|
|
begin
|
|
- If (FormatSettings.DateFormat<>'') then
|
|
|
|
|
|
+ If (FormatSettings.DateFormat<>'') and (not F.IsNull) then
|
|
Result:=FormatDateTime(FormatSettings.DateFormat,F.AsDateTime)
|
|
Result:=FormatDateTime(FormatSettings.DateFormat,F.AsDateTime)
|
|
else if FormatSettings.UseDisplayText then
|
|
else if FormatSettings.UseDisplayText then
|
|
Result:=F.DisplayText
|
|
Result:=F.DisplayText
|
|
@@ -619,7 +625,7 @@ begin
|
|
end
|
|
end
|
|
else if (F.DataType=ftTime) then
|
|
else if (F.DataType=ftTime) then
|
|
begin
|
|
begin
|
|
- If (FormatSettings.TimeFormat<>'') then
|
|
|
|
|
|
+ If (FormatSettings.TimeFormat<>'') and (not F.IsNull) then
|
|
Result:=FormatDateTime(FormatSettings.TimeFormat,F.AsDateTime)
|
|
Result:=FormatDateTime(FormatSettings.TimeFormat,F.AsDateTime)
|
|
else if FormatSettings.UseDisplayText then
|
|
else if FormatSettings.UseDisplayText then
|
|
Result:=F.DisplayText
|
|
Result:=F.DisplayText
|
|
@@ -628,7 +634,7 @@ begin
|
|
end
|
|
end
|
|
else if (F.DataType in [ftDateTime,ftTimeStamp]) then
|
|
else if (F.DataType in [ftDateTime,ftTimeStamp]) then
|
|
begin
|
|
begin
|
|
- If (FormatSettings.DateTimeFormat<>'') then
|
|
|
|
|
|
+ If (FormatSettings.DateTimeFormat<>'') and (not F.IsNull) then
|
|
Result:=FormatDateTime(FormatSettings.DateTimeFormat,F.AsDateTime)
|
|
Result:=FormatDateTime(FormatSettings.DateTimeFormat,F.AsDateTime)
|
|
else if FormatSettings.UseDisplayText then
|
|
else if FormatSettings.UseDisplayText then
|
|
Result:=F.DisplayText
|
|
Result:=F.DisplayText
|
|
@@ -637,13 +643,13 @@ begin
|
|
end
|
|
end
|
|
else if (F.DataType=ftCurrency) then
|
|
else if (F.DataType=ftCurrency) then
|
|
begin
|
|
begin
|
|
- If (FormatSettings.CurrencySymbol<>'') then
|
|
|
|
|
|
+ If (FormatSettings.CurrencySymbol<>'') and (not F.IsNull) then
|
|
begin
|
|
begin
|
|
FS:=DefaultFormatSettings;
|
|
FS:=DefaultFormatSettings;
|
|
FS.CurrencyString:=FormatSettings.CurrencySymbol;
|
|
FS.CurrencyString:=FormatSettings.CurrencySymbol;
|
|
Result:=CurrToStrF(F.AsCurrency,ffCurrency,FormatSettings.CurrencyDigits,FS);
|
|
Result:=CurrToStrF(F.AsCurrency,ffCurrency,FormatSettings.CurrencyDigits,FS);
|
|
end
|
|
end
|
|
- else if FormatSettings.UseDisplayText then
|
|
|
|
|
|
+ else if FormatSettings.UseDisplayText then
|
|
Result:=F.DisplayText
|
|
Result:=F.DisplayText
|
|
else
|
|
else
|
|
Result:=F.AsUTF8String;
|
|
Result:=F.AsUTF8String;
|
|
@@ -839,6 +845,7 @@ end;
|
|
procedure TCustomExportFormatSettings.InitSettings;
|
|
procedure TCustomExportFormatSettings.InitSettings;
|
|
begin
|
|
begin
|
|
FIntegerFormat:='%d';
|
|
FIntegerFormat:='%d';
|
|
|
|
+ FHandleNullField:=True;
|
|
FDateFormat:=ShortDateFormat;
|
|
FDateFormat:=ShortDateFormat;
|
|
FTimeFormat:=ShortTimeFormat;
|
|
FTimeFormat:=ShortTimeFormat;
|
|
FDateTimeFormat:=ShortDateFormat+' '+ShortTimeFormat;
|
|
FDateTimeFormat:=ShortDateFormat+' '+ShortTimeFormat;
|
|
@@ -863,6 +870,7 @@ begin
|
|
If (Source is TCustomExportFormatSettings) then
|
|
If (Source is TCustomExportFormatSettings) then
|
|
begin
|
|
begin
|
|
FS:=Source as TCustomExportFormatSettings;
|
|
FS:=Source as TCustomExportFormatSettings;
|
|
|
|
+ FHandleNullField:=FS.FHandleNullField;
|
|
FBooleanFalse:=FS.FBooleanFalse;
|
|
FBooleanFalse:=FS.FBooleanFalse;
|
|
FBooleanTrue:=FS.FBooleanTrue;
|
|
FBooleanTrue:=FS.FBooleanTrue;
|
|
FCurrencyDigits:=FS.FCurrencyDigits;
|
|
FCurrencyDigits:=FS.FCurrencyDigits;
|