Example 1: Disable progress dialog and show progress bar
TForm1 = class(TForm)
[...]
ProgressBar1: TProgressBar;
private
procedure CustomProgress(const Sender: TOExport;
const aType: TExportProgressNotificationType; const aPos, aCount: Integer);
procedure DoMillionExport;
end;
procedure TForm1.DoMillionExport;
var
xExport: TOExport;
I, L, J: Integer;
begin
xExport := TOExport.Create;
try
xExport.OnProgress := CustomProgress;
with xExport.AddWorkSheet('Million') do
for I := 1 to 5000 do
with AddRow do begin
for L := 1 to 200 do begin
AddCellString(ExcelRange(L-1, I-1));
end;
end;
xExport.SaveToFileWithDialog(docDir+'million.xlsx');
finally
xExport.Free;
end;
end;
procedure TForm1.CustomProgress(const Sender: TOExport;
const aType: TExportProgressNotificationType; const aPos, aCount: Integer);
begin
ProgressBar1.Max := aCount;
ProgressBar1.Position := aPos;
end;
Example 2: Disable progress dialog
Use the UseProgress property of TOExport.
procedure TForm1.DoExport;
var
xExport: TOExport;
begin
xExport := TOExport.Create;
try
xExport.UseProgress := False;
// ... //
finally
xExport.Free;
end;
end;