Skip to main content
Tab

ASPxGridViewExportRenderingEventArgs.XlsxFormatString Property

Specifies the format string applied to the processed brick’s value when exporting to Excel format (XLS or XLSX).

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public string XlsxFormatString { get; set; }

Property Value

Type Description
String

A String value.

Remarks

Use the XlsxFormatString property to specify an Excel format string which is applied to the brick’s value when exporting to XLS or XLSX.

Example

The following example illustrates how to use the XlsxFormatString property.

Web Forms approach:

protected void Exporter2_RenderBrick(object sender, DevExpress.Web.ASPxGridViewExportRenderingEventArgs e) {
    if (e.RowType == GridViewRowType.Data && e.TextValue != null) {
        double numericValue = 0;
        if (Double.TryParse(e.TextValue.ToString(), out numericValue)) {
            e.XlsxFormatString = "0.00";
            e.TextValue = numericValue;
        }
    }
}
...

MVC approach:

@Html.DevExpress().GridView(settings => {
    settings.Name = "Grid1";

    settings.Columns.Add("ID");
    settings.Columns.Add("Text");

    settings.SettingsExport.RenderBrick = (sender, e) => {
        if (e.RowType == GridViewRowType.Data && e.TextValue != null) {
            double numericValue = 0;
            if (Double.TryParse(e.TextValue.ToString(), out numericValue)) {
                e.XlsxFormatString = "0.00";
                e.TextValue = numericValue;
            }
        }
    };
}).Bind(Model).GetHtml()
See Also