Below is an example of creating and using a form used to export multiple express reports intto a single XLS file.
Firstly, create a form. Place the following components on the form: Button, Label, EditBox, MetabaseOpenDialog and Memo:

The form should work as follows: the user clicks the Export button, after which the dialog box for opening repository objects opens. Only express reports can be selected in this dialog box. If the user selects one or several express reports, they should be exported to the file specified in the EditBox component in the XLS format. By default, the C:\ExportReport.xls file is specified in the EditBox component. Messages on export progress are displayed in the Memo component.
First, set the OnCreate event for the form as follows:
Sub BatchExportFormOnCreate(Sender: Object; Args: IEventArgs);
Begin
EditBox1.Text := "C:\ExportReport.xls";
Memo1.Lines.Clear;
End Sub BatchExportFormOnCreate;
Then set the OnClick event for the Button component as follows:
Sub Button1OnClick(Sender: Object; Args: IEventArgs);
Var
Filter: IMetabaseDialogClassFilter;
Objects: IMetabaseObjectDescriptorList;
List: IStringList;
Exp: ExAnalyzerExporter;
i, Count: integer;
id: String;
Begin
MetabaseOpenDialog1.MultiSelect := True;
//Create a filter for repository object opening dialog box
Filter := New MetabaseDialogClassFilter.Create;
Filter.Description := "Express reports";
//Determine a type of objects, which will be shown in the dialog on using
//of this filter: express report
Filter.ObjectClass := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
List := Memo1.Lines;
List.Clear;
MetabaseOpenDialog1.Filters.AddFilter(Filter);
If MetabaseOpenDialog1.Execute(Self) Then
//These expressions are executed if the user selected one or more express reports
Objects := MetabaseOpenDialog1.Objects;
Count := Objects.Count;
List.Add("Number of reports selected for export:" + Count.ToString);
//Start of batch export of selected reports
Exp := New ExAnalyzerExporter.Create;
Exp.StartBatchCommand(EditBox1.Text, "XLS");
For i := 0 To Count - 1 Do
id := Objects.Item(i).Id;
Exp.ExAnalyzer := MetabaseClass.Active.ItemById(id).Bind As IEaxAnalyzer;
Exp.ExportToFile("", "XLS");
Memo1.Lines.Add("Report '" + Objects.Item(i).Name + "' exported");
End For;
//End of batch export of selected reports
Exp.FinishBatchCommand;
List.Add("Export of reports finished");
End If;
End Sub Button1OnClick;
After the compilation, on the start the form looks like follows:

One should click the Export button, after which the repository object opening dialog box opens. Select the express reports to be exported in this dialog box. After this, the reports are exported to the C:\ExportReport.xls file. Messages on export progress are displayed in the Memo component:

See also: