Class DataGridExcelExportingController
Represents a class which defines various options to export the SfDataGrid to an excel worksheets. Provides classes, methods, properties, and events to export and customize the exported values of a SfDataGrid.
Inherited Members
Namespace: Syncfusion.Maui.DataGrid.Exporting
Assembly: Syncfusion.Maui.DataGridExport.dll
Syntax
public class DataGridExcelExportingController
Constructors
DataGridExcelExportingController()
Initializes a new instance of the DataGridExcelExportingController class.
Declaration
public DataGridExcelExportingController()
Methods
ExportCaptionSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, string, string, DataGridExcelExportingOption)
Export caption summary cell to excel.
Declaration
protected void ExportCaptionSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, string columnName, DataGridExcelExportingOption exportOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| IRange | summaryRange | |
| ExportCellType | exportCellType | |
| string | summaryDisplayText | |
| string | columnName | |
| DataGridExcelExportingOption | exportOption |
ExportCellFormat(IRange, object, DataGridColumn)
Applies the cell format for the cell area based on grid column format such as currency, percentage, date time etc..
Declaration
protected void ExportCellFormat(IRange cellArea, object cellValue, DataGridColumn gridColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | cellArea | |
| object | cellValue | |
| DataGridColumn | gridColumn |
ExportCellValue(SfDataGrid, RecordEntry, DataGridColumn, IRange, DataGridExcelExportingOption, object)
Exports cell value to the excel, cell value are obtained from the record using gridcolumn mappping name. when exporting each cell exporting event handler is called. For image column, image is converted as stream and then image will exports. For switch column, check box will export. When overridden in a derived class, is invoked whenever application code or internal processes call ExportCellValue
Declaration
[RequiresUnreferencedCode("The ExportCellValue method is not trim compatible")]
protected void ExportCellValue(SfDataGrid dataGrid, RecordEntry record, DataGridColumn column, IRange cellArea, DataGridExcelExportingOption exportOption, object pagedRecord = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| RecordEntry | record | |
| DataGridColumn | column | |
| IRange | cellArea | |
| DataGridExcelExportingOption | exportOption | |
| object | pagedRecord |
ExportDetailsViewToExcel(SfDataGrid, object, IWorksheet, DataGridExcelExportingOption, IPropertyAccessProvider?)
Exports the details view of a record to Excel.
Declaration
protected virtual void ExportDetailsViewToExcel(SfDataGrid parentDataGrid, object record, IWorksheet sheet, DataGridExcelExportingOption exportOption, IPropertyAccessProvider? propertyAccessProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | parentDataGrid | |
| object | record | |
| IWorksheet | sheet | |
| DataGridExcelExportingOption | exportOption | |
| IPropertyAccessProvider | propertyAccessProvider |
ExportGroupSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, string, string, DataGridExcelExportingOption)
Export the group summary cell text to Excel.
Declaration
protected void ExportGroupSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, string columnName, DataGridExcelExportingOption exportOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| IRange | summaryRange | |
| ExportCellType | exportCellType | |
| string | summaryDisplayText | |
| string | columnName | |
| DataGridExcelExportingOption | exportOption |
ExportMultiRowViewRecordsToExcel(SfDataGrid, IRecordsEntryList, DataGridExcelExportingOption)
Exports the records with the multi-row view layout to the excel worksheet. Each grid record occupies the number of excel rows defined by the layout, and the RowSpan and ColumnSpan are exported as merged excel cells.
Declaration
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The ExportCellValue method is not trim compatible")]
protected void ExportMultiRowViewRecordsToExcel(SfDataGrid dataGrid, IRecordsEntryList records, DataGridExcelExportingOption exportOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | SfDataGrid instance. |
| IRecordsEntryList | records | The records to be exported. |
| DataGridExcelExportingOption | exportOption | Grid Excel ExportingOptions. |
ExportRecordToExcel(SfDataGrid, RecordEntry?, IRange, DataGridExcelExportingOption, object)
Exports a record to the excel worksheet. GridRowExcelExporting Event handler for record is handled here. When overridden in a derived class, is invoked whenever application code or internal processes call ExportRecordToExcel
Declaration
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The ExportCellValue method is not trim compatible")]
protected void ExportRecordToExcel(SfDataGrid dataGrid, RecordEntry? record, IRange rowRange, DataGridExcelExportingOption exportOption, object pagedRecord = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| RecordEntry | record | |
| IRange | rowRange | |
| DataGridExcelExportingOption | exportOption | |
| object | pagedRecord |
ExportTableSummariesToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportingOption)
Export the table summaries to excel.
Declaration
protected void ExportTableSummariesToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet sheet, DataGridExcelExportingOption exportOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| DataGridExcelExportingOption | exportOption |
ExportTableSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, string, string, DataGridExcelExportingOption)
Export the table summary display text to excel.
Declaration
protected void ExportTableSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, string columnName, DataGridExcelExportingOption exportOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| IRange | summaryRange | |
| ExportCellType | exportCellType | |
| string | summaryDisplayText | |
| string | columnName | |
| DataGridExcelExportingOption | exportOption |
ExportTableSummaryToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, IRange, DataGridExcelExportingOption, SummaryRecordEntry)
Export the table summary row to excel
Declaration
protected void ExportTableSummaryToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet sheet, IRange rowArea, DataGridExcelExportingOption exportOption, SummaryRecordEntry summaryRecordEntry)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| IRange | rowArea | |
| DataGridExcelExportingOption | exportOption | |
| SummaryRecordEntry | summaryRecordEntry |
ExportToExcel(SfDataGrid)
Exports the data in the grid to the excel work sheet based on default export option and returns the excel engine.
Declaration
public ExcelEngine ExportToExcel(SfDataGrid dataGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid |
Returns
| Type |
|---|
| ExcelEngine |
ExportToExcel(SfDataGrid, ICollectionViewAdv, DataGridExcelExportingOption)
Exports the data in the grid to the excel work sheet based on given export option and returns the excel engine.
Declaration
public ExcelEngine ExportToExcel(SfDataGrid dataGrid, ICollectionViewAdv collectionView, DataGridExcelExportingOption exportingOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| ICollectionViewAdv | collectionView | |
| DataGridExcelExportingOption | exportingOption |
Returns
| Type |
|---|
| ExcelEngine |
ExportToExcel(SfDataGrid, ICollectionViewAdv, DataGridExcelExportingOption, IWorksheet)
Exports the data in the grid to the given excel work sheet based on given export option and returns the excel worksheet.
Declaration
public IWorksheet ExportToExcel(SfDataGrid dataGrid, ICollectionViewAdv collectionView, DataGridExcelExportingOption exportingOption, IWorksheet worksheet)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| ICollectionViewAdv | collectionView | |
| DataGridExcelExportingOption | exportingOption | |
| IWorksheet | worksheet |
Returns
| Type |
|---|
| IWorksheet |
ExportToExcel(SfDataGrid, DataGridExcelExportingOption)
Exports the data in the grid to the excel work sheet based on the given export option and returns the excel engine.
Declaration
public ExcelEngine ExportToExcel(SfDataGrid dataGrid, DataGridExcelExportingOption exportOption)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| DataGridExcelExportingOption | exportOption |
Returns
| Type |
|---|
| ExcelEngine |
ExportToExcel(SfDataGrid, ObservableCollection<object>, DataGridExcelExportingOption)
Exports the selected rows in the grid to the excel work sheet based on either given export option or default export option and returns the excel engine.
Declaration
public ExcelEngine ExportToExcel(SfDataGrid dataGrid, ObservableCollection<object> selectedItems, DataGridExcelExportingOption exportOption = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| ObservableCollection<object> | selectedItems | |
| DataGridExcelExportingOption | exportOption |
Returns
| Type |
|---|
| ExcelEngine |
ExportUnboundRowCellToExcel(SfDataGrid, IRange, DataGridExcelExportingOption, DataGridUnboundRow, DataGridColumn)
Export Unbound row cell value to excel.
Declaration
protected virtual void ExportUnboundRowCellToExcel(SfDataGrid grid, IRange excelrange, DataGridExcelExportingOption excelExportingOptions, DataGridUnboundRow gridUnboundRow, DataGridColumn gridColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IRange | excelrange | |
| DataGridExcelExportingOption | excelExportingOptions | |
| DataGridUnboundRow | gridUnboundRow | |
| DataGridColumn | gridColumn |
ExportUnboundRowToExcel(SfDataGrid, IWorksheet, DataGridExcelExportingOption, DataGridUnboundRow, ExportCellType)
Export unbound row to excel.
Declaration
protected void ExportUnboundRowToExcel(SfDataGrid dataGrid, IWorksheet sheet, DataGridExcelExportingOption exportOption, DataGridUnboundRow gridUnboundRow, ExportCellType celltype)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| IWorksheet | sheet | |
| DataGridExcelExportingOption | exportOption | |
| DataGridUnboundRow | gridUnboundRow | |
| ExportCellType | celltype |
ExportUnboundRowsToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportingOption, DataGridUnboundRowPosition, bool, ObservableCollection<DataGridUnboundRow>)
Exports unbound rows to excel.
Declaration
protected void ExportUnboundRowsToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet sheet, DataGridExcelExportingOption exportOption, DataGridUnboundRowPosition position, bool belowSummary, ObservableCollection<DataGridUnboundRow> unBoundRows = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| DataGridExcelExportingOption | exportOption | |
| DataGridUnboundRowPosition | position | |
| bool | belowSummary | |
| ObservableCollection<DataGridUnboundRow> | unBoundRows |
Events
CellExporting
Occurs when the cell is being exported to excel.
Declaration
public event EventHandler<DataGridCellExcelExportingEventArgs>? CellExporting
Event Type
| Type |
|---|
| EventHandler<DataGridCellExcelExportingEventArgs> |
DataGridChildExcelExporting
Occurs when a details view (child grid) is being exported to Excel.
Declaration
public event EventHandler<DataGridChildExcelExportingEventArgs>? DataGridChildExcelExporting
Event Type
| Type |
|---|
| EventHandler<DataGridChildExcelExportingEventArgs> |
RowExporting
Occurs when the row is being exported to excel.
Declaration
public event EventHandler<DataGridRowExcelExportingEventArgs>? RowExporting
Event Type
| Type |
|---|
| EventHandler<DataGridRowExcelExportingEventArgs> |