What Changed
In data-aware export mode, the ExportToCsv
methods of affected controls now export cell display text. Previous versions exported underlying cell values.
Reasons for Change
In previous versions, the controls' ExportToCsv
methods exported cell values instead of text if the CsvExportOptionsEx.TextExportMode property was set to Text
(default) in data-aware export mode.
Now, if the CsvExportOptionsEx.TextExportMode property is set to Text
, the ExportToCsv
methods export cell display text.
The current change does not affect WYSIWYG export mode.
Impact on Existing Apps
The default output of the ExportToCsv
method is different for v20.1.4+ and previous versions.
- Export of Boolean Columns in Grid Controls
v20.1.4+: Values of Boolean grid columns (true, false and null) are exported as "Checked", "Unchecked" and "Indeterminate" strings.
Previous versions: Values of Boolean columns (true, false and null) are exported as "TRUE", "FALSE" and an empty string. - Custom Display Text
v20.1.4+: Custom display text provided for cells via events (for example, WinForms GridView.CustomColumnDisplayText, WPF GridControl.CustomColumnDisplayText, ASPxGridView.CustomColumnDisplayText, and ASPxVerticalGrid.CustomRowDisplayText) is taken into account
Previous versions: Custom display text provided via these events is ignored.
How to Revert to Previous Behavior
To export cell values to CSV format, call the ExportToCsv
method with a CsvExportOptionsEx object passed as the options
parameter. Set the CsvExportOptionsEx.TextExportMode property to Value
.
WinForms Data Grid:
C#CsvExportOptionsEx optionsCsv = new CsvExportOptionsEx();
optionsCsv.TextExportMode = TextExportMode.Value;
gridView1.ExportToCsv(pathCsv, optionsCsv);
Visual BasicDim optionsCsv As New CsvExportOptionsEx
optionsCsv.TextExportMode = TextExportMode.Value
GridView1.ExportToCsv(pathCsv, optionsCsv)
ASP.NET Grid View:
ASPx<dx:ASPxGridView ID="ASPxGridView1" runat="server" OnBeforeExport="ASPxGridView1_BeforeExport" .....
C#protected void ASPxGridView1_BeforeExport(object sender, DevExpress.Web.ASPxGridBeforeExportEventArgs e) {
if(e.ExportTarget == ExportTarget.Csv) {
var opts = e.ExportOptions as CsvExportOptionsEx;
opts.TextExportMode = TextExportMode.Value;
}
}
Visual BasicProtected Sub ASPxGridView1_BeforeExport(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridBeforeExportEventArgs)
If e.ExportTarget = ExportTarget.Csv Then
Dim opts = TryCast(e.ExportOptions, CsvExportOptionsEx)
opts.TextExportMode = TextExportMode.Value
End If
End Sub