ExportToFile(FileName: String; FormatTag: String);
FileName. File name, to which export is performed.
FormatTag. File format, to which export is performed. Various export types are available depending on the exported file.
The ExportToFile method exports an object to a file of the specified format.
The description of export features of specific object types is presented in the sections:
Maps and charts contained in a dashboard are exported as an image.
The following formats of dashboards export are available:
Excel workbook (*.xls).
PDF document (*.pdf).
RTF document (*.rtf).
Web page, single file archive (*.mht).
EMF document (*.emf).
PowerPoint presentation (*.ppxt).
Executing the example requires that the repository contains a dashboard with the ADHOC identifier containing a block with the IQY1DKCFA3U5BTQP identifier.
Add links to the AdHoc and Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Rep: IAdhocReport;
Ex: IAdhocReportExporter;
Begin
mb := MetabaseClass.Active;
// Get dashboard
Rep := mb.ItemById("ADHOC").Bind As IAdhocReport;
// Create an export object
Ex := New AdhocReportExporter.Create;
// Specify exported panel
Ex.AdhocReport := Rep;
// Specify exported block
Ex.DataSources := "IQY1DKCFA3U5BTQP";
// Execute export
Ex.ExportToFile("C:\Dashboard.xls", "XLS");
End Sub UserProc;
After executing the example the block with the specified identifier is exported to the C:\Dashboard.xls file.
A workspace can be exported to the following formats:
bmp.
png.
jpg.
gif.
tiff.
Executing the example requires that the repository contains a workspace with the WORKSPACE identifier.
Add links to the Andy and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
WS: IWxWorkspace;
View: IWxView;
Exp: IWxViewExporter;
Begin
MB := MetabaseClass.Active;
WS := MB.ItemById("WORKSPACE").Open(Null) As IWxWorkspace;
View := WS.CreateView;
Exp := New WxViewExporter.Create;
Exp.WxView := View;
Exp.ExportToFile("C:\РП.png", "png");
End Sub UserProc;
After executing the example the workspace is exported to the WS.png file.
The chart export is available to the following formats:
jpg.
bmp.
png.
tiff.
gif.
html.
xaml.
Executing the example requires that the repository contains an express report with the EAX_REPORT identifier.
Add links to the Chart, Express, and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Exp: IChartExporter;
Begin
MB := MetabaseClass.Active;
Express := MB.ItemById("EAX_REPORT").Open(Null) As IEaxAnalyzer;
Exp := New ChartExporter.Create;
Exp.Chart := Express.Chart.Chart;
Exp.Scale := 0.5;
Exp.ExportToFile("C:\Chart.png", "png");
End Sub UserProc;
After executing the example, the express report chart is exported to the Chart.png format.
A 3D scene can be exported to the following formats:
jpg.
bmp.
png.
tiff.
gif.
html.
An express report can be exported to the following formats:
mht.
html.
pdf.
xls.
xlsx.
rtf.
emf.
pptx.
NOTE. If an export of several reports to one file is required, use the ExportToFile method together with IExAnalyzerExporter.StartBatchCommand and IExAnalyzerExporter.FinishBatchCommand.
Executing the example requires that the repository contains an express report with the EAX_REPORT identifier.
Add links to the Express and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Exp: IExAnalyzerExporter;
Begin
MB := MetabaseClass.Active;
Express := MB.ItemById("EAX_REPORT").Open(Null) As IEaxAnalyzer;
Exp := New ExAnalyzerExporter.Create;
Exp.ExAnalyzer := Express;
Exp.ExportToFile("C:\Analazer.xls", "XLS");
End Sub UserProc;
After executing the example the express report is exported to the Analyzer.xls file.
A regular report can be exported to the following formats:
xlsx.
xls.
pdf.
rtf.
ppxt.
html.
mht.
ods.
emf.
png. For correct export of a regular report to PNG, determine a range of exported sheets.
If an export of several reports to one file is required, use the ExportToFile method together with IExAnalyzerExporter.StartBatchCommand and IExAnalyzerExporter.FinishBatchCommand methods.
Executing the example requires that the repository contains a regular report with the REPORT identifier.
Add links to the Metabase and Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Exp: IPrxReportExporter;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REPORT").Open(Null) As IPrxReport;
Exp := New PrxReportExporter.Create;
Exp.Report := Report;
Exp.ExportSheetTitles := True;
Exp.ExportRange := "1:0";
Exp.ExportToFile("C:\" + Report.Name + ".png", "png");
End Sub UserProc;
After executing the example a regular report is exported a PNG file. Sheet names will be in output file.
Table icons can be exported to the following formats:
png.
jpg.
bmp.
gif.
tiff.
Executing the example requires that the repository contains a regular report with the REPORT identifier. The report sheet contains the icons, for example:
Add links to the Metabase, Report and Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Exp: ITabIconExporter;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REPORT").Open(Null) As IPrxReport;
Exp := New TabIconExporter.Create;
Exp.TabSheet := (Report.ActiveSheet As IPrxTable).TabSheet;
Exp.IconIndex := 0;
Exp.ExportToFile("C:\Icon1.gif", "gif");
End Sub UserProc;
After executing the example the first sheet icon is exported to the specified file.
A table can be exported to the following formats:
gif.
jpg.
bmp.
gif.
tiff.
XAML (for charts only).
Executing the example requires that the repository contains a regular report with the REPORT identifier. The report sheet contains an object.
Add links to the Metabase and Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Exp: ITabObjectExporter;
Tab: ITabSheet;
Obj: ITabObject;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REPORT").Open(Null) As IPrxReport;
Tab := (Report.Sheets.Item(0) As IPrxTable).TabSheet;
Obj := Tab.Objects.Item(0);
Exp := New TabObjectExporter.Create;
Exp.Object := Obj;
Exp.ExportToFile("C:\Object.png", "png");
End Sub UserProc;
After executing the example the report sheet object is exported to the specified file.
A regular report sheet can be exported to the following formats:
html.
mht.
pdf.
xls.
xlsx.
rtf.
ods.
emf
pptx.
Executing the example requires that the repository contains a regular report with the REPORT identifier.
Add links to the Metabase, Report and Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Exp: ITabSheetExporter;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("REPORT").Open(Null) As IPrxReport;
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Exp := New TabSheetExporter.Create;
Exp.TabSheet := Tab;
Exp.ExportObjects := False;
Exp.ExportToFile("c:\Sheet.xls", "XLS");
End Sub UserProc;
After executing the example the active regular report sheet is exported to an XLS file. The objects located on the table sheet are not exported.
See also: