1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
var
lst,lstLigne: TStringList;
i,j : integer;
Begintime, endtime,TickPerSec : int64;
begin
if OpenDialog1.Execute then
begin
QueryPerformanceCounter(BeginTime);
lst := TStringList.Create;
lstLigne := TStringList.Create;
try
lst.LoadFromFile(OpenDialog1.FileName);
ProgressBar1.Max := lst.Count div 255;
ProgressBar1.Min := 0;
ProgressBar1.Step := 1;
StringGrid1.RowCount := lst.Count + 1;
StringGrid1.ColCount := 1;
StringGrid1.Rows[0].BeginUpdate;
for i := 0 to lst.Count -1 do
begin
lstLigne.Text := lst.Strings[i];
lstLigne.Text := StringReplace(lstLigne.text,';',#13#10,[rfReplaceAll]);
if lstLigne.Count > StringGrid1.ColCount then
StringGrid1.ColCount := lstLigne.count -1;
While Trim(lstLigne.Strings[lstLigne.Count-1]) = '' do
lstLigne.Delete(lstLigne.Count-1);
for j := 0 to lstLigne.Count -1 do
StringGrid1.Cells[j,i+1] := lstLigne.Strings[j];
if not ByteBool(i) then
ProgressBar1.stepit();// := i * 100 div (lst.count -1);
// Application.ProcessMessages;
end;
StringGrid1.Rows[0].EndUpdate;
QueryPerformanceCounter(EndTime);
QueryPerformanceFrequency(TickPerSec);
Showmessage(IntToStr(Round((EndTime - BeginTime) / TickPerSec * 1000)));
finally
lst.free;
lstligne.free;
end;
end; |
Partager