Skip to main content
A newer version of this page is available. .

CsvExportOptions.EncodeExecutableContent Property

Gets or sets whether to encode potentially dangerous content from a control or document when it is exported to a CSV file.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v20.2.Core.dll

NuGet Packages: DevExpress.Printing.Core, DevExpress.WindowsDesktop.Printing.Core

Declaration

[Browsable(false)]
[DefaultValue(DefaultBoolean.Default)]
public DefaultBoolean EncodeExecutableContent { get; set; }

Property Value

Type Default Description
DefaultBoolean **Default**

True, to encode potentially dangeorous content; otherwise, False. Default, to use the ExportSettings.EncodeCsvExecutableContent property value.

Available values:

Name Description
True

Corresponds to a Boolean value of true.

False

Corresponds to a Boolean value of false.

Default

The value is determined by the current object’s parent object setting (e.g., a control setting).

Property Paths

You can access this nested property as listed below:

Library Object Type Path to EncodeExecutableContent
Cross-Platform Class Library ExportOptions
.Csv .EncodeExecutableContent
WPF Controls ExportOptionsContainer
.Csv .EncodeExecutableContent

Remarks

Exported data can contain executable content. Such content makes it possible to execute dangerous commands if a user opens a file in Microsoft Excel and confirms that the file can be loaded and commands executed.

Set the EncodeExecutableContent property to True to add the quote character to a control or document’s executable content when it is exported to CSV.

If this property is set to Default, EncodeCsvExecutableContent property value is used.

// ASP.NET Web Forms GridView
protected void ExportToCSVButton_Click(object sender, EventArgs e){
    var options = new CsvExportOptionsEx();
    options.EncodeExecutableContent = DefaultBoolean.True;
    Grid.ExportCsvToResponse(options);
}

To encode executable content at the application level, use the ExportSettings.EncodeCsvExecutableContent property instead.

// ASP.NET
void Application_Start(object sender, EventArgs e) {
    DevExpress.Export.ExportSettings.EncodeCsvExecutableContent = DevExpress.Utils.DefaultBoolean.True;
}

Tip

The EncodeExecutableContent property overrides the EncodeCsvExecutableContent property. If EncodeExecutableContent is set to True, executable content is encoded even if EncodeCsvExecutableContent is set to False.

See Also