Class DataGridExcelExportingController
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.
Inheritance
Namespace: Syncfusion.SfDataGrid.XForms.Exporting
Assembly: Syncfusion.SfGridConverter.XForms.dll
Syntax
public class DataGridExcelExportingController : Object
Constructors
DataGridExcelExportingController()
Initializes a new instance of the DataGridExcelExportingController class.
Declaration
public DataGridExcelExportingController()
Methods
add_CellExporting(DataGridCellExcelExportingEventHandler)
Declaration
public void add_CellExporting(DataGridCellExcelExportingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridCellExcelExportingEventHandler | value |
add_RowExporting(DataGridRowExcelExportingEventHandler)
Declaration
public void add_RowExporting(DataGridRowExcelExportingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowExcelExportingEventHandler | value |
ExportCaptionSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, String, String, DataGridExcelExportingOption)
Export the table summary display text to excel.
Declaration
protected virtual void ExportCaptionSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, string columnName, DataGridExcelExportingOption exportOption)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | Specifies the SfDataGrid. |
IRange | summaryRange | Specifies the excel range. |
ExportCellType | exportCellType | Specifies the excel cell type. |
System.String | summaryDisplayText | Specifies the summary text. |
System.String | columnName | Specifies the column name. |
DataGridExcelExportingOption | exportOption | Specifies the instance of class DataGridExcelExportingOption which is used to set the exporting options. |
ExportCellFormat(IRange, Object, GridColumn)
Applies the cell format for the cell area based on grid column format such as currency ,percentage , date time etc...
Declaration
protected virtual void ExportCellFormat(IRange cellArea, object cellValue, GridColumn gridColumn)
Parameters
Type | Name | Description |
---|---|---|
IRange | cellArea | IRange value |
System.Object | cellValue | object cell value |
GridColumn | gridColumn | GridColumn value |
ExportCellValue(SfDataGrid, RecordEntry, GridColumn, 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
protected virtual void ExportCellValue(SfDataGrid dataGrid, RecordEntry record, GridColumn column, IRange cellArea, DataGridExcelExportingOption exportOption, object pagedRecord = null)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | SfDataGrid instance |
RecordEntry | record | RecordEntry value |
GridColumn | column | GridColumn value |
IRange | cellArea | IRange value |
DataGridExcelExportingOption | exportOption | Grid Excel ExportingOptions |
System.Object | pagedRecord | object for excel exporting option |
ExportGroupSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, String, String, DataGridExcelExportingOption)
Export the table summary display text to excel.
Declaration
protected virtual void ExportGroupSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, string columnName, DataGridExcelExportingOption exportOption)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | Specifies the SfDataGrid. |
IRange | summaryRange | Specifies the excel range. |
ExportCellType | exportCellType | Specifies the excel cell type. |
System.String | summaryDisplayText | Specifies the summary text. |
System.String | columnName | Specifies the column name. |
DataGridExcelExportingOption | exportOption | Specifies the instance of class DataGridExcelExportingOption which is used to set the exporting options. |
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
protected virtual void ExportRecordToExcel(SfDataGrid dataGrid, RecordEntry record, IRange rowRange, DataGridExcelExportingOption exportOption, object pagedRecord = null)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | SfDataGrid instance |
RecordEntry | record | RecordEntry value |
IRange | rowRange | IRange value |
DataGridExcelExportingOption | exportOption | Grid Excel ExportingOptions |
System.Object | pagedRecord | object for Excel exporting |
ExportTableSummariesToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportingOption)
Export the table summaries to excel.
Declaration
protected virtual void ExportTableSummariesToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet sheet, DataGridExcelExportingOption exportOption)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | Specifies the SfDataGrid. |
ICollectionViewAdv | view | Specifies the grid collection. |
IWorksheet | sheet | Specifies the WorkSheet. |
DataGridExcelExportingOption | exportOption | Specifies the instance of class DataGridExcelExportingOption which is used to set the exporting options. |
ExportTableSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, String, String, DataGridExcelExportingOption)
Export the table summary display text to excel.
Declaration
protected virtual void ExportTableSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, string columnName, DataGridExcelExportingOption exportOption)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | Specifies the SfDataGrid. |
IRange | summaryRange | Specifies the excel range. |
ExportCellType | exportCellType | Specifies the excel cell type. |
System.String | summaryDisplayText | Specifies the summary text. |
System.String | columnName | Specifies the column name. |
DataGridExcelExportingOption | exportOption | Specifies the instance of class DataGridExcelExportingOption which is used to set the exporting options. |
ExportTableSummaryToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, IRange, DataGridExcelExportingOption, SummaryRecordEntry)
Export the table summary row to excel.
Declaration
protected virtual void ExportTableSummaryToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet sheet, IRange rowArea, DataGridExcelExportingOption exportOption, SummaryRecordEntry summaryRecordEntry)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | Specifies the SfDataGrid. |
ICollectionViewAdv | view | Specifies the grid collection. |
IWorksheet | sheet | Specifies the WorkSheet. |
IRange | rowArea | Specifies the IRange. |
DataGridExcelExportingOption | exportOption | Specifies the instance of class DataGridExcelExportingOption which is used to set the exporting options. |
SummaryRecordEntry | summaryRecordEntry | Specifies the summary record entry. |
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 | The reference of the SfDataGrid. |
Returns
Type | Description |
---|---|
ExcelEngine | The ExcelEngine for exporting the data in the SfDataGrid to the excel. |
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 | The reference of the SfDataGrid. |
ICollectionViewAdv | collectionView | The underlying collection of the SfDataGrid. |
DataGridExcelExportingOption | exportingOption | The DataGridExcelExportingOption containing the additional options for customizing the data in the grid when exporting to excel. |
Returns
Type | Description |
---|---|
ExcelEngine | The ExcelEngine for exporting the data in the grid to the excel. |
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 | The reference of the SfDataGrid. |
ICollectionViewAdv | collectionView | The underlying collection of the SFDataGrid. |
DataGridExcelExportingOption | exportingOption | The DataGridExcelExportingOption containing the additional options for customizing the data in the grid when exporting to excel. |
IWorksheet | worksheet | The worksheet for exporting the data in the grid to the excel. |
Returns
Type | Description |
---|---|
IWorksheet | The worksheet containing the exported data in the grid. |
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 | The reference of the SfDataGrid. |
DataGridExcelExportingOption | exportOption | The DataGridExcelExportingOption containing the additional options for customizing the data in the grid when exporting to excel. |
Returns
Type | Description |
---|---|
ExcelEngine | The ExcelEngine for exporting the data in the grid to the excel. |
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 | The reference of the SfDataGrid. |
System.Collections.ObjectModel.ObservableCollection<System.Object> | selectedItems | The SelectedItems collection in SfDataGrid. |
DataGridExcelExportingOption | exportOption | The DataGridExcelExportingOption containing the additional options for customizing the data in the grid when exporting to excel. |
Returns
Type | Description |
---|---|
ExcelEngine | The ExcelEngine for exporting the selected rows in the grid to the excel. |
ExportUnboundRowCellToExcel(SfDataGrid, IRange, DataGridExcelExportingOption, GridUnboundRow, GridColumn)
Declaration
protected virtual void ExportUnboundRowCellToExcel(SfDataGrid grid, IRange excelrange, DataGridExcelExportingOption excelExportingOptions, GridUnboundRow gridUnboundRow, GridColumn gridColumn)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | grid | |
IRange | excelrange | |
DataGridExcelExportingOption | excelExportingOptions | |
GridUnboundRow | gridUnboundRow | |
GridColumn | gridColumn |
ExportUnboundRowsToExcel(SfDataGrid, ICollectionView, IWorksheet, DataGridExcelExportingOption, UnboundRowsPosition, Boolean, ObservableCollection<GridUnboundRow>)
Declaration
protected virtual void ExportUnboundRowsToExcel(SfDataGrid dataGrid, ICollectionView view, IWorksheet sheet, DataGridExcelExportingOption exportOption, UnboundRowsPosition position, bool belowSummary, ObservableCollection<GridUnboundRow> unBoundRows = null)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | |
Syncfusion.Data.ICollectionView | view | |
IWorksheet | sheet | |
DataGridExcelExportingOption | exportOption | |
UnboundRowsPosition | position | |
System.Boolean | belowSummary | |
System.Collections.ObjectModel.ObservableCollection<GridUnboundRow> | unBoundRows |
ExportUnboundRowToExcel(SfDataGrid, IWorksheet, DataGridExcelExportingOption, GridUnboundRow, ExportCellType)
Declaration
protected virtual void ExportUnboundRowToExcel(SfDataGrid dataGrid, IWorksheet sheet, DataGridExcelExportingOption exportOption, GridUnboundRow gridUnboundRow, ExportCellType celltype)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | |
IWorksheet | sheet | |
DataGridExcelExportingOption | exportOption | |
GridUnboundRow | gridUnboundRow | |
ExportCellType | celltype |
remove_CellExporting(DataGridCellExcelExportingEventHandler)
Declaration
public void remove_CellExporting(DataGridCellExcelExportingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridCellExcelExportingEventHandler | value |
remove_RowExporting(DataGridRowExcelExportingEventHandler)
Declaration
public void remove_RowExporting(DataGridRowExcelExportingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowExcelExportingEventHandler | value |
Events
CellExporting
Occurs when the cell is being exported to excel.
Declaration
public event DataGridCellExcelExportingEventHandler CellExporting
Event Type
Type |
---|
DataGridCellExcelExportingEventHandler |
Remarks
This event is raised while exporting a cell at the execution time before the cell is exported.
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
excelExport.CellExporting += excelExport_CellExporting;
private void excelExport_CellExporting(object sender, DataGridCellExcelExportingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
RowExporting
Occurs when the row is being exported to excel.
Declaration
public event DataGridRowExcelExportingEventHandler RowExporting
Event Type
Type |
---|
DataGridRowExcelExportingEventHandler |
Remarks
This event is raised while exporting a row at the execution time before the row is exported.
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
excelExport.RowExporting += excelExport_RowExporting;
private void excelExport_RowExporting(object sender, DataGridRowPdfExportingEventArgs e)
{
//You can achieve your requirement here.
}