Hi Kenny
In think in your case must simplier option is to use variables.
See the pictures attached.
You can even store the variables the database and loop over it
Here is updated script for your convinience
var
CrystalRFileName: String;
ExportFileName: String;
CrystalRApplication, CrystalReport: Variant;
begin
CrystalRFileName := GetVariable('<CrystalRFileName>') ;
ExportFileName := GetVariable('<ExportFileName>') ;
CrystalRApplication := Null;
CrystalReport := Null;
try
CrystalRApplication := CreateOleObject('CrystalRunTime.Application');
CrystalReport := CreateOleObject('CrystalRunTime.Report');
//Result := CrystalRApplication.GetVersion;
except
CrystalRApplication := Null;
CrystalReport := Null;
end;
If VarIsNull(CrystalRApplication) = False then
begin
try
//Result := CrystalRApplication.GetVersion;
try
CrystalReport := CrystalRApplication.OpenReport(CrystalRFileName);
CrystalReport.ExportOptions.FormatType := 31;
CrystalReport.ExportOptions.DiskFileName := ExportFileName;
CrystalReport.ExportOptions.DestinationType := 1;
CrystalReport.ExportOptions.PDFExportAllPages := True;
CrystalReport.Export(False);
Result := CrystalReport.ApplicationName;
except
CrystalReport := Null;
end;
finally
//Result := CrystalRApplication.CanClose;
Result := true;
end;
end;
end;
Very impressive script BTW