ASPxTreeListExportRenderBrickEventArgs.XlsxFormatString Property
In This Article
Specifies the format string applied to the processed brick’s value when exporting to Excel format (XLS or XLSX).
Namespace: DevExpress.Web.ASPxTreeList
Assembly: DevExpress.Web.ASPxTreeList.v24.2.dll
NuGet Package: DevExpress.Web
#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 ASPxTreeListExporter1_RenderBrick(object sender, DevExpress.Web.ASPxTreeList.ASPxTreeListExportRenderBrickEventArgs e) {
if ( e.RowKind == DevExpress.Web.ASPxTreeList.TreeListRowKind.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().TreeList(settings => {
settings.Name = "TreeList1";
settings.Columns.Add("ID");
settings.Columns.Add("Text");
settings.SettingsExport.RenderBrick = (sender, e) => {
if (e.RowKind == DevExpress.Web.ASPxTreeList.TreeListRowKind.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