好的,如果人们想知道我对 TMS DBAdvGrid 做了一个解决方法来导出 CSV 文件。
我向 TAdvStringGrid 添加了一个新属性
public {properties}
property HideCSVHeader: boolean read FHideCSVHeader write FHideCSVHeader;
并更改了以下代码:
procedure TAdvStringGrid.OutputToCSV(FileName:String;appendmode: Boolean;
Unicode: boolean);
....
//changed this code further down the procedure:
//for z := SaveStartRow to SaveEndRow do
//Into:
MyStartRow:= SaveStartRow;
if HideCSVHeader then Inc(MyStartRow);
for z := MyStartRow to SaveEndRow do
然后当我打电话
procedure TForm1.BtnExportClick(Sender: TObject);
var
Filename: string;
succes: Boolean;
begin
succes:= True;
if ExportSaveDialog.Execute then begin
Filename:= ExportSaveDialog.FileName;
try
DBGridExportExact.Delimiter:= ';';
DBGridExportExact.AlwaysQuotes:= True;
DBGridExportExact.QuoteEmptyCells:= True;
DBGridExportExact.SaveHiddenCells:= True;
DBGridExportExact.HideCSVHeader:= True;
DBGridExportExact.SaveToCSV(bestandsnaam);
except
succes:= False;
end;
if not(succes) then StatusLabel.Caption:= 'Error bla bla';
end;
end;