Progress for ImportCSV
Posted: Mon Mar 05, 2007 10:15 am
The OnProgress event seems to be triggered only for reading/writing xls-files. Is there a way to use it while importing csv-files aswell?
Code: Select all
// 1. Reset the progress.
ProgressCount := 0;
if Assigned(XLS.OnProgress) then
FXLS.OnProgress(Self,0);
// 2. Insert this code after the for loop in the ImportCSVInt function.
// You shall also add two int variables, V and ProgressCount
if Assigned(XLS.OnProgress) then begin
V := Round((i / Lines.Count) * 100);
// Don't update the progress for each line, as this can slow things down...
if V > ProgressCount then begin
ProgressCount := V;
XLS.OnProgress(Self,ProgressCount);
end;
end;
// 3. At the end of the function, make sure that progress is at 100.
if Assigned(XLS.OnProgress) then
XLS.OnProgress(Self,100);