IDtOdsConsumer.File

Syntax

File: String;

Description

The File property determines the path and the name of the file, in which the data is exported.

Example

Executing the example requires that the repository contains a table with the TABLE identifier.

Add links to the Db, Dt, and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MBProvider: IDtMetabaseProvider;
    OdsConsumer: IDtOdsConsumer;
    SourceFields, DestinationFields: IDtFieldDefinitions;
    Field: IDtFieldDefinition;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    // Data provider - repository table
    MBProvider := New DtMetabaseProvider.Create;
    MBProvider.Dataset := MB.ItemById("TABLE").Bind As IDatasetModel;
    SourceFields := MBProvider.Fields;
    // Data consumer - the OpenDocument file
    OdsConsumer := New DtOdsConsumer.Create;
    OdsConsumer.File := "D:\TableData.ods";
    OdsConsumer.Sheet := "TABLE DATA";
    OdsConsumer.HasHeader := True;
    OdsConsumer.ForceFullCalculation := True;
    DestinationFields := OdsConsumer.Fields;
    DestinationFields.Clear;
    For i := 0 To SourceFields.Count - 1 Do
        Field := DestinationFields.Add;
        Field.DataType := SourceFields.Item(i).DataType;
        Field.Name := SourceFields.Item(i).Name;
    End For;
    OdsConsumer.Open;
    OdsConsumer.Clear;
    OdsConsumer.PutProvider(MBProvider);
    OdsConsumer.Close;
End Sub UserProc;

After executing the example, data from the specified table will be exported to the OpenDocument spreadsheet file.

See also:

IDtOdsConsumer