IDtExcelConsumerEx.File

Fore Syntax

File: String;

Fore.NET Syntax

File: string;

Description

The File property determines the entire name of the file, in which data will be loaded.

Comments

The name of the sheet, in which data is loaded, is determined by the IDtExcelConsumerEx.Sheet property.

Fore example

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.

Fore.NET Example

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.

Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Cubes;

Public Shared Sub Main(Params: StartParams);
Var
    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 := Params.Metabase;
    Exporter.Rubricator := MB.ItemById["FC_COMM_26"].Bind() As IRubricator;
    Exporter.Consumer := Consumer As IDtConsumer;
// The COUNTRY attribute export parameters
    Binding := Exporter.Bindings.Add();
    Binding.FieldName := "CountryKey";
    Binding.DataType := DbDataType.ddtInteger;
    Binding.BindingType := CubeMetaExporterBindingType.cmebtAttribute;
    Binding.Attribute := "COUNTRY";
    Binding.KeyField := "KEY";
// Values export parameters  
    Binding := Exporter.Bindings.Add();
    Binding.FieldName := "Year";
    Binding.DataType := DbDataType.ddtString;
    Binding.BindingType := CubeMetaExporterBindingType.cmebtCalendar;
    Binding.DateFormat := "$Year$";
    Binding.ValueFieldName := "Value";
    Binding.ValueDataType := DbDataType.ddtFloat;
    Exporter.ByColumns := False;
    Exporter.CalendarLevel := DimCalendarLevel.dclYear;
// Export
    Exporter.Export();
End Sub;

After executing this example, data from time series database FC is loaded to the file C:\result.xlsx on the sheet Sheet1.

See also:

IDtExcelConsumerEx