ASPxVerticalGridRenderBrickEventArgs.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.2.dll
Declaration
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 ASPxVerticalGridExporter1_RenderBrick(object sender, DevExpress.Web.ASPxVerticalGridRenderBrickEventArgs e)
{
if (e.ExportPart = DevExpress.Web.VerticalGridExportPart.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().VerticalGrid(settings=> {
settings.Name = "VerticalGrid";
settings.Rows.Add("ID");
settings.Rows.Add("Text");
settings.SettingsExport.RenderBrick = (sender, e) => {
if (e.ExportPart == VerticalGridExportPart.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