Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.41 KB

Excel_export.md

File metadata and controls

35 lines (23 loc) · 1.41 KB

Blazor WASM with GridCore back-end (gRPC)

Export to Excel

Index

Grids can be exported to an Excel file. You have to use the SetExcelExport method of the GridClient object:

    var client = new GridClient<Order>(gridClientService.GetOrdersGridRows, query, false, "ordersGrid", Columns)
        .SetExcelExport(true, false, "Orders"));

The SetExcelExport method has 3 parameters, one of them is required:

Parameter Description
enabled bool to enable Excel export (required)
allRows bool to enable export of all grid rows (optional). The default value is false and only visible rows are exported
fileName string to define the file name (optional). If no value is defined, the grid internal name is used as file name

You can construct a custom display value of the column only for the exported file using the RenderExcelAs method:

    Columns.Add(o => o.Employees.LastName)
       .RenderExcelAs(o => o.Employees.FirstName + " " + o.Employees.LastName)

This is an example of a grid with an export to Excel button:

Grid columns can be customised as hidden (or not) specifically when exporting to Excel; either by calling SetExcelHidden(bool?) or setting the ExcelHidden property on the column definition.

<- Embedded components on the grid | Grid dimensions ->