TitleSettings: IAdhocReportExportSourceTitle;
None;
The TitleSettings property returns parameters of exporting block title.
By default, the parameters are not set and blocks are exported without titles.
Executing the example requires that the repository contains a dashboard with the DASHBOARD identifier. Add links to the Adhoc, Drawing, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
repObj: IMetabaseObject;
report: IAdhocReport;
repExporter: IAdhocReportExporter;
reportDS: IAdhocDataSourceObjects;
expReportDS: IAdhocReportExportSources;
i: Integer;
expSrc: IAdhocReportExportSource;
expSrcTitle: IAdhocReportExportSourceTitle;
Begin
mb := MetabaseClass.Active;
// Get dashboard
repObj := mb.ItemById("DASHBOARD").Edit;
report := repObj As IAdhocReport;
// Create an object to export a dashboard
repExporter := New AdhocReportExporter.Create;
repExporter.AdhocReport := report;
// Get dashboard blocks
reportDS := report.DataSourceObjects;
// Get exported blocks
expReportDS := repExporter.Sources;
// Add exported blocks
For i := 0 To reportDS.Count - 1 Do
expSrc := expReportDS.Add(reportDS.Item(i));
// Set up parameters of exported block title
expSrcTitle := expSrc.TitleSettings;
expSrcTitle.Text := "Title of the block #" + (i + 1).ToString;
expSrcTitle.Font := New GxFont.Create("Courier", 12);
expSrcTitle.Color := New GxColor.CreateRGB(0, 0, 255);
expSrcTitle.HorizontalAlignment := AdhocHorizontalAlignment.Right;
Debug.WriteLine("The title of the block is set up with identifier '" + expSrc.DataSource.Id + "'");
End For;
Debug.WriteLine("Total number of configured block titles: " + expReportDS.Count.ToString);
// Run export
repExporter.ExportToFile("C:\Dashboard.rtf", "rtf");
// Save changes
repObj.Save;
End Sub UserProc;
Example execution result: parameters of export of the title are set for all dashboard blocks having a data source. Export is executed to the C:\Dashboard.rtf file.
See also: