TreeListExportOptions.CustomizeCell Property
Allows you to customize a cell in the exported file.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public Action<TreeListExportCustomizeCellEventArgs> CustomizeCell { get; set; }
Property Value
Type | Description |
---|---|
Action<TreeListExportCustomizeCellEventArgs> | A delegate method that customize the cell. |
Remarks
The CustomizeCell
action allows you to perform the following actions:
- Substitute the cell value (Value)
- Insert a hyperlink in the cell (Hyperlink)
- Customize the cell format (Formatting)
Set the Handled property to true
to apply the specified settings. Otherwise, the cell is exported with the default settings. The GetRowValue(String) method returns the value of the specified data field in the current row.
The table below lists properties that you can use to get additional information about the processed cell depending on the processed area type (AreaType).
Area Type | Related Properties | Properties That Return null |
---|---|---|
Header |
ColumnFieldName | DataItem, SummaryItem |
DataArea |
ColumnFieldName, DataItem | SummaryItem |
TotalFooter |
ColumnFieldName, SummaryItem | DataItem |
The following example colors exported data cells light yellow:
async Task ExportXlsx_Click() {
await MyTreeList.ExportToXlsxAsync("ExportResult", new TreeListXlExportOptions() {
CustomizeCell = CustomizeCell
});
}
void CustomizeCell(TreeListExportCustomizeCellEventArgs e) {
if (e.AreaType == DevExpress.Export.SheetAreaType.DataArea) {
e.Formatting.BackColor = System.Drawing.Color.LightYellow;
}
// Set the Handled property to true to apply the specified settings
e.Handled = true;
}
For more information about data export in the TreeList component, refer to the following topic: Export Data in Blazor TreeList.