Hizo estas alteraciones:
Código Delphi
[-]function TForm1.TextFoundInFile(path: string; const FileMask:string; const tipo, tabela: string): TStrings;
var
SR: TSearchRec;
txt: TextFile;
Row: string;
Found: Boolean;
i: Integer;
NroExt: TStrings;
begin
NroExt:= TStringList.Create;
try
NroExt.Delimiter:= ';';
NroExt.DelimitedText:= FileMask;
path := IncludeTrailingPathDelimiter(path);
Result := TStringList.Create;
for i:= 0 to NroExt.Count - 1 do
begin
if FindFirst(path + NroExt[i], faAnyFile - faDirectory, SR) = 0 then
repeat
AssignFile(txt,path + SR.Name);
Reset(txt);
Found:= False;
while not Eof(txt) and not Found do
begin
Readln(txt, Row);
if Pos(tabela, Row) > 0 then
begin
Result.Add(tipo + ';' + tabela + ';' + SR.Name);
Found:= True
end
end;
CloseFile(txt);
until FindNext(SR) <> 0
end
finally
NroExt.Free;
end
end;
El problema es quando me voy a exportar para excel. No estas funcionando. Abajo la forma como yo hago:
Código Delphi
[-]procedure TForm1.VarrerClick(Sender: TObject);
begin
ClientDataSet1.Open;
pth := IncludeTrailingPathDelimiter(edtDir.Directory);
while not ClientDataSet1.Eof do
begin
TextFoundInFile(pth,'*.pas;*.dfm',ClientDataSet1.FieldByName('xtype').AsString,ClientDataSet1.FieldB yName('name').AsString).SaveToFile('D:\Teste\LISTA.xls');
ClientDataSet1.Next;
end;
end;