procedure gy_DBGrid_to_excel(pdbgrid:TDBGrid; pFile:string;pQu:TQuery);
var vlst1,vlst : TStringList;
vPath,s : string;
i : integer;
begin
vlst1 := TStringList.Create;
vlst := TStringList.Create;
s := ";
for i:=0 to pdbgrid.Columns.Count -1 do begin
vlst.Add(IntToStr(pQu.FieldByName(pdbgrid.Columns[i].FieldName).index));
if s <>" then s := s + ';';
s := s+pdbgrid.Columns[i].Title.Caption;
end;
vLst1.Add(s);
pQu.First;
s := ";
while not pQu.Eof do begin
s := ";
for i:=0 to vlst.count -1 do begin
if s <>" then s := s + ';';
s := s +pQu.Fields[StrToInt(vlst.Strings[i])].AsString;
end;
vLst1.Add(s);
pQu.Next;
end;
vPath := 'c:\koala\temp';
gy_Create_Dir(vPath);
vLst1.SaveToFile(vPath+'\koala.csv');
gy_uyari_mesaji('Uyari', vPath+'\koala.csv dosyasi yaratildi.'+chr(13)+' Sütün Ayiraci ; kullanildi',MB_OK);
s := gy_register_oku(false,'\software\classes\applications\excel.exe\shell\open\command',");
if s=" then
s := gy_register_oku(false,'\software\classes\excel.csv\shell\open\command',");
gy_calistir(1,s+' '+vPath+'\koala.csv');
end;