Using a custom CSV exporter

Sometimes you may want to define a CSV exporter with custom column delimiter etc. There are 2 possibilities to do that:

1. Using a custom exporter class

Example: your CSV file is not comma-separated but colon-separated and you want to import the file. (Use similar approach for saving a file).
procedure TForm1.BtnCustomCSVClick(Sender: TObject);
var
  xExport: TOExport;
  xCSV: TOExporterCSVComma;
begin
  xCSV := TOExporterCSVComma.Create;
  xExport := TOExport.Create;
  try
    xCSV.ColumnDelimiter := ':';

    xExport.LoadFromFile('your-file', xCSV);
  finally
    xCSV.Free;
    xExport.Free;
  end;
end;
Categories