fcldb - TCustomCSVExporter - DoDataHeader - Export all field captions, even those that Enabled = False
Original Reporter info from Mantis: zgabrovski
-
Reporter name: Zdravko Gabrovski
Original Reporter info from Mantis: zgabrovski
- Reporter name: Zdravko Gabrovski
Description:
There is a small bug in procedure TCustomCSVExporter.DoDataHeader; , fpcsvexport, line 125.
Currently, missing a check if the field is enabled, it export all field names.
Current implementation:
procedure TCustomCSVExporter.DoDataHeader;
Var
I : Integer;
begin
If FormatSettings.HeaderRow then
begin
For I:=0 to ExportFields.Count-1 do
begin
FCSVOut.AppendCell(ExportFields[i].ExportedName); <------ Here must be changed
end;
FCSVOut.AppendRow; //close off with line ending
end;
inherited DoDataHeader;
end;
Must be:
procedure TCustomCSVExporter.DoDataHeader;
Var
I : Integer;
begin
If FormatSettings.HeaderRow then
begin
For I:=0 to ExportFields.Count-1 do
begin
If FExportFields[I].Enabled then // <- Change
FCSVOut.AppendCell(ExportFields[i].ExportedName);
end;
FCSVOut.AppendRow; //close off with line ending
end;
inherited DoDataHeader;
end;
Steps to reproduce:
Add a TCSVExporter component, link it to your favor dataset, add two fields for export, and check "Enabled" property to first field to False.
In Format settings, Select "HeaderRow" property to "True".
After call the .Execute method, it will export the data only for the second field, but will export header for both fields.
Mantis conversion info:
- Mantis ID: 36385
- OS: all
- OS Build: all
- Build: trunk
- Platform: all
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 43639 (#0add0779)
- Target version: 3.2.0