Skip to main content
All docs
V25.1
  • TreeListCsvExportOptions.Encoding Property

    Specifies the encoding of the exported CSV file.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public Encoding Encoding { get; set; }

    Property Value

    Type Description
    Encoding

    The file encoding.

    Remarks

    Use the Encoding property to specify the encoding of the exported CSV file.

    The following example sets the current encoding to UTF-32 and adds its preamble to the exported file:

    @using System.Text
    
    <DxButton Text="Export to CSV" Click="ExportCsv_Click" />
    <DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId" @ref="MyTreeList">
        <Columns>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    
    @code {
        ITreeList MyTreeList { get; set; }
    
        async Task ExportCsv_Click() {
            await MyTreeList.ExportToCsvAsync("ExportResult", new TreeListCsvExportOptions() {
                Encoding = Encoding.UTF8,
                AddEncodingPreamble = true
            });
        }
    }
    
    See Also