File: String;
The File property determines the entire name of the file, in which data will be loaded.
The name of the sheet, in which data is loaded, is determined by the IDtExcelConsumerEx.Sheet property.
Executing the example requires that the repository contains a time series database with the FC identifier. The database contains the COUNTRY factor attribute that is a link to the dictionary. Add links to the Metabase, Dt, Cubes, Dal, Dimensions system assemblies.
Sub UserProc;
Consumer: DtExcelConsumerEx;
MB: IMetabase;
Exporter: ICubeMetaExporter;
Binding: ICubeMetaExporterBinding;
Begin
// Data consumer for export to Excel format
Consumer := New DtExcelConsumerEx.Create;
Consumer.File := "C:\result.xlsx";
Consumer.HasHeader := True;
Consumer.Sheet := "Sheet1";
// Export parameters
Exporter := New CubeMetaExporterClass.Create;
MB := MetabaseClass.Active;
Exporter.Rubricator := MB.ItemById("FC").Bind As IRubricator;
Exporter.Consumer := Consumer As IDtConsumer;
// The COUNTRY attribute export parameters
Binding := Exporter.Bindings.Add;
Binding.FieldName := "CountryKey";
Binding.DataType := DbDataType.Integer;
Binding.BindingType := CubeMetaExporterBindingType.Attribute;
Binding.Attribute := "COUNTRY";
Binding.KeyField := "KEY";
// Values export parameters
Binding := Exporter.Bindings.Add;
Binding.FieldName := "Year";
Binding.DataType := DbDataType.String;
Binding.BindingType := CubeMetaExporterBindingType.Calendar;
Binding.DateFormat := "$Year$";
Binding.ValueFieldName := "Value";
Binding.ValueDataType := DbDataType.Float;
Exporter.ByColumns := False;
Exporter.CalendarLevel := DimCalendarLevel.Year;
// Export
Exporter.Export;
End Sub UserProc;
After executing the example, data from time series database FC is loaded to the file C:\result.xlsx on the sheet Sheet1.
See also: