Class SfDataGridToExcelConverter
Provides the base implementation to export the SfDataGrid to Excel.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.Grid.Converter
Assembly: Syncfusion.SfGridConverter.WPF.dll
Syntax
public class SfDataGridToExcelConverter
Remarks
It provides the set of public and virtual methods to customize the rows and columns while exporting.
Constructors
SfDataGridToExcelConverter()
Declaration
public SfDataGridToExcelConverter()
Fields
ColumnFormat
Declaration
protected Dictionary<GridColumn, string> ColumnFormat
Field Value
| Type |
|---|
| System.Collections.Generic.Dictionary<GridColumn, System.String> |
Properties
ExcelColumnIndex
Gets or sets the column index of ExcelSheet which keeps track of the Excel column index while exporting.
Declaration
protected int ExcelColumnIndex { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
ExcelRowIndex
Gets or sets the row index of ExcelSheet which keeps track of the Excel row index while exporting.
Declaration
protected int ExcelRowIndex { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
Methods
ExportDetailsViewDataGridToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions)
Declaration
protected virtual void ExportDetailsViewDataGridToExcel(SfDataGrid sourceDataGrid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | sourceDataGrid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
ExportDetailsViewToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions, Object, IPropertyAccessProvider)
Export DetailsViewDefinition to Excel.
Declaration
protected virtual void ExportDetailsViewToExcel(SfDataGrid parentDataGrid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, object rec, IPropertyAccessProvider propertyAccessProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | parentDataGrid | Specifies the SfDataGrid. |
| IWorksheet | sheet | Specifies the WorkSheet. |
| ExcelExportingOptions | excelExportingOptions | Specifies the exporting options. |
| System.Object | rec | Specifies the RecordEntry. |
| IPropertyAccessProvider | propertyAccessProvider | Specifies the PropertyAccessProvider. |
ExportGroupCaptionToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions, Group)
Declaration
protected virtual void ExportGroupCaptionToExcel(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| Group | group |
ExportGroupSummariesToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions, Group)
Declaration
protected virtual void ExportGroupSummariesToExcel(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| Group | group |
ExportGroupToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions, Group)
Declaration
protected virtual void ExportGroupToExcel(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| Group | group |
ExportHeadersToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions)
Declaration
protected virtual void ExportHeadersToExcel(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
ExportImageColumnToExcel(IRange, Object, Object)
Export GridImageColumn to excel.
Declaration
protected virtual void ExportImageColumnToExcel(IRange excelRange, object record, object cellValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | excelRange | Specifies the excel range. |
| System.Object | record | Specifies the record. |
| System.Object | cellValue | Specifies the cell value. |
ExportNumberFormatToExcel(IRange, IStyle, GridColumn, Object)
Export NumberFormat to Excel.
Declaration
protected virtual void ExportNumberFormatToExcel(IRange excelrange, IStyle gridColumnFormat, GridColumn gridColumn, object cellValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | excelrange | The Excel range to which the column format will be exported. |
| IStyle | gridColumnFormat | Specifies the Excel number format. |
| GridColumn | gridColumn | Specifies the GridColumn. |
| System.Object | cellValue | Specifies the cell value. |
ExportRecordCellToExcel(SfDataGrid, IRange, ExcelExportingOptions, Object, IPropertyAccessProvider, GridColumn)
Declaration
protected virtual void ExportRecordCellToExcel(SfDataGrid grid, IRange excelrange, ExcelExportingOptions excelExportingOptions, object record, IPropertyAccessProvider propertyAccessProvider, GridColumn gridColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IRange | excelrange | |
| ExcelExportingOptions | excelExportingOptions | |
| System.Object | record | |
| IPropertyAccessProvider | propertyAccessProvider | |
| GridColumn | gridColumn |
ExportRecordsToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions, IEnumerable, IPropertyAccessProvider, Group)
Declaration
protected virtual void ExportRecordsToExcel(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, IEnumerable records, IPropertyAccessProvider propertyAccessProvider, Group group)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| System.Collections.IEnumerable | records | |
| IPropertyAccessProvider | propertyAccessProvider | |
| Group | group |
ExportRecordToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions, Object, Int32, IPropertyAccessProvider)
Export record to excel.
Declaration
protected virtual void ExportRecordToExcel(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, object record, int startColumnIndex, IPropertyAccessProvider propertyAccessProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | Specifies the SfDataGrid. |
| IWorksheet | sheet | Specifies the WorkSheet. |
| ExcelExportingOptions | excelExportingOptions | Specifies the instance of class |
| System.Object | record | Specifies the record. |
| System.Int32 | startColumnIndex | Specifies the startColumnIndex. |
| IPropertyAccessProvider | propertyAccessProvider | Specifies the property access provider. |
ExportRowStyle(IRange, IStyle, Int32)
Export row style to Excel.
Declaration
protected virtual void ExportRowStyle(IRange excelRange, IStyle style, int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | excelRange | Specifies the Excel range. |
| IStyle | style | Specifies the style. |
| System.Int32 | rowIndex | Specifies the row index. |
ExportStackedHeadersToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions)
Declaration
protected virtual void ExportStackedHeadersToExcel(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions exportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | exportingOptions |
ExportStackedHeaderToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions, StackedHeaderRow)
Declaration
protected virtual void ExportStackedHeaderToExcel(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions exportingOptions, StackedHeaderRow stackedHeaderRow)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | exportingOptions | |
| StackedHeaderRow | stackedHeaderRow |
ExportSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, String, Object, String, ExcelExportingOptions)
Declaration
protected virtual void ExportSummaryCellToExcel(SfDataGrid grid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, object exportNodeEntry, string columnName, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IRange | summaryRange | |
| ExportCellType | exportCellType | |
| System.String | summaryDisplayText | |
| System.Object | exportNodeEntry | |
| System.String | columnName | |
| ExcelExportingOptions | excelExportingOptions |
ExportTableSummariesToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions, TableSummaryRowPosition)
Declaration
protected virtual void ExportTableSummariesToExcel(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, TableSummaryRowPosition position)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| TableSummaryRowPosition | position |
ExportTableSummaryToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions, SummaryRecordEntry)
Declaration
protected virtual void ExportTableSummaryToExcel(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, SummaryRecordEntry summaryRecordEntry)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| SummaryRecordEntry | summaryRecordEntry |
ExportToExcel(SfDataGrid, ICollectionViewAdv, ExcelExportingOptions)
Declaration
public virtual ExcelEngine ExportToExcel(SfDataGrid grid, ICollectionViewAdv view, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| ExcelExportingOptions | excelExportingOptions |
Returns
| Type |
|---|
| ExcelEngine |
ExportToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions)
Declaration
public virtual void ExportToExcel(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
ExportToExcel(SfDataGrid, ObservableCollection<Object>, ExcelExportingOptions)
Declaration
public virtual ExcelEngine ExportToExcel(SfDataGrid grid, ObservableCollection<object> selectedItems, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| System.Collections.ObjectModel.ObservableCollection<System.Object> | selectedItems | |
| ExcelExportingOptions | excelExportingOptions |
Returns
| Type |
|---|
| ExcelEngine |
ExportToExcel(SfDataGrid, ObservableCollection<Object>, IWorksheet, ExcelExportingOptions)
Declaration
public virtual void ExportToExcel(SfDataGrid grid, ObservableCollection<object> selectedItems, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| System.Collections.ObjectModel.ObservableCollection<System.Object> | selectedItems | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
ExportToExcelWorksheet(SfDataGrid, ICollectionViewAdv, IWorksheet, ExcelExportingOptions)
Declaration
protected virtual void ExportToExcelWorksheet(SfDataGrid grid, ICollectionViewAdv view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| ICollectionViewAdv | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
ExportUnboundRowCellToExcel(SfDataGrid, IRange, ExcelExportingOptions, GridUnBoundRow, GridColumn)
Declaration
protected virtual void ExportUnboundRowCellToExcel(SfDataGrid grid, IRange excelrange, ExcelExportingOptions excelExportingOptions, GridUnBoundRow gridUnboundRow, GridColumn gridColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IRange | excelrange | |
| ExcelExportingOptions | excelExportingOptions | |
| GridUnBoundRow | gridUnboundRow | |
| GridColumn | gridColumn |
ExportUnboundRowsToExcel(SfDataGrid, ICollectionView, IWorksheet, ExcelExportingOptions, UnBoundRowsPosition, Boolean, ObservableCollection<GridUnBoundRow>)
Declaration
protected virtual void ExportUnboundRowsToExcel(SfDataGrid grid, ICollectionView view, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, UnBoundRowsPosition position, bool belowSummary, ObservableCollection<GridUnBoundRow> unBoundRows = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| System.ComponentModel.ICollectionView | view | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| UnBoundRowsPosition | position | |
| System.Boolean | belowSummary | |
| System.Collections.ObjectModel.ObservableCollection<GridUnBoundRow> | unBoundRows |
ExportUnboundRowToExcel(SfDataGrid, IWorksheet, ExcelExportingOptions, GridUnBoundRow)
Declaration
protected virtual void ExportUnboundRowToExcel(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, GridUnBoundRow gridUnboundRow)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions | |
| GridUnBoundRow | gridUnboundRow |
GetCellValue(Object, IPropertyAccessProvider, GridColumn, ExportMode)
Gets record cell value to export.
Declaration
protected virtual object GetCellValue(object record, IPropertyAccessProvider propertyAccessProvider, GridColumn gridColumn, ExportMode exportMode)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | record | Specifies the record. |
| IPropertyAccessProvider | propertyAccessProvider | Specifies the property access provider. |
| GridColumn | gridColumn | Specifies the GridColumn. |
| ExportMode | exportMode | Specifies the export mode. |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the cell value to export. |
GetExcelStartColumnIndex(SfDataGrid, IWorksheet, ExcelExportingOptions, Group)
Method returns the start column index in excel.
Declaration
protected virtual int GetExcelStartColumnIndex(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions, Group group = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | Specifies the SfDataGrid. |
| IWorksheet | sheet | Specifies the WorkSheet. |
| ExcelExportingOptions | excelExportingOptions | Specifies the exporting option. |
| Group | group | Specifies the Group. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Returns start column index of excel. |
InitializeCellStyle(SfDataGrid, IWorksheet, ExcelExportingOptions)
Declaration
protected virtual void InitializeCellStyle(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
SetColumnWidth(SfDataGrid, IWorksheet, ExcelExportingOptions)
Declaration
protected virtual void SetColumnWidth(SfDataGrid grid, IWorksheet sheet, ExcelExportingOptions excelExportingOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | |
| IWorksheet | sheet | |
| ExcelExportingOptions | excelExportingOptions |
SetIndentColumnWidth(IWorksheet, Int32, Int32)
Sets the indent column width.
Declaration
protected virtual void SetIndentColumnWidth(IWorksheet sheet, int start, int end)
Parameters
| Type | Name | Description |
|---|---|---|
| IWorksheet | sheet | Specifies the WorkSheet. |
| System.Int32 | start | Specifies the start indent column index |
| System.Int32 | end | Specifies the end indent column index |