Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    TreeListCsvExportOptions.EncodeExecutableContent Property

    Specifies whether to enclose potentially dangerous content in quotation marks when it is exported to a CSV file.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    #Declaration

    C#
    public bool EncodeExecutableContent { get; set; }

    #Property Value

    Type Description
    Boolean

    true to encode content; otherwise, false.

    #Remarks

    Important

    Exported data can contain executable content. Microsoft Excel implements their own algorithm for unsafe content detection. The application warns you if it finds values with potentially dangerous content within the document. However, such content makes it possible to execute dangerous commands if a user opens a CSV file in Microsoft Excel and confirms that the file can be loaded and commands executed.

    #Security Considerations

    To prevent possible security vulnerabilities, set the EncodeExecutableContent property to true to enclose potentially dangerous content in quotation marks prior to exporting it to the CSV format. Note that it can result in undesired data modification. The export engine transforms the values in the following ways:

    • Values started with ‘=’ or ‘@‘ are enclosed in quotation marks.
    • Values started with ‘+’ or ‘-‘ cannot be converted to the Double format. They are enclosed in quotation marks.

    If the EncodeExecutableContent property is not specified, the EncodeCsvExecutableContent property value determines the export behavior.

    Razor
    <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() {
                EncodeExecutableContent = true
            });
        }
    }
    
    See Also