menu

Class DataGridToExcelConverter - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DataGridToExcelConverter

    Represents a class that provides the base implementation to export the SfDataGrid to an Excel file.

    Inheritance
    System.Object
    DataGridToExcelConverter
    Namespace: Syncfusion.UI.Xaml.DataGrid.Export
    Assembly: Syncfusion.GridExport.WinUI.dll
    Syntax
    public class DataGridToExcelConverter : Object
    Remarks

    Provides a set of public and virtual methods that can be overridden to customize the rows and columns of the exported data.

    Constructors

    DataGridToExcelConverter()

    Declaration
    public DataGridToExcelConverter()

    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, DataGridExcelExportOptions)

    Exports the data in a details view DataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportDetailsViewDataGridToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The details view DataGrid whose data will be exported.

    ICollectionViewAdv view

    The view of the details view DataGrid.

    IWorksheet worksheet

    The worksheet to which the data will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported data.

    ExportDetailsViewToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions, Object, IPropertyAccessProvider)

    Exports the details view definition of a record in the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportDetailsViewToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, object record, IPropertyAccessProvider propertyAccessProvider)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the record whose details view definition will be exported.

    IWorksheet worksheet

    The worksheet to which the details view definition will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported details view definition.

    System.Object record

    The record whose details view definition will be exported.

    IPropertyAccessProvider propertyAccessProvider

    The PropertyAccessProvider used to access the properties of the record.

    ExportGroupCaptionToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions, Group)

    Exports the group caption to an Excel worksheet.

    Declaration
    protected virtual void ExportGroupCaptionToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, Group group)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid from which the group caption will be exported.

    ICollectionViewAdv view

    The view of the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the group caption will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the group caption.

    Group group

    The group whose caption is to be exported.

    ExportGroupSummariesToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions, Group)

    Exports the summary rows for a specific group in the SfDataGrid to the specified worksheet.

    Declaration
    protected virtual void ExportGroupSummariesToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, Group group)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the group summary rows to be exported.

    ICollectionViewAdv view

    The view of the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the group summary rows will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of DataGridExcelExportOptions used to customize the Excel export process.

    Group group

    The group whose summary rows will be exported.

    ExportGroupToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions, Group)

    Exports the groups in the SfDataGrid to the specified worksheet.

    Declaration
    protected virtual void ExportGroupToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, Group group)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the groups to be exported.

    ICollectionViewAdv view

    The view of the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the groups will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to customize the Excel export process.

    Group group

    The group to be exported.

    ExportHeadersToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions)

    Exports the headers of the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportHeadersToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid whose headers will be exported.

    IWorksheet worksheet

    The worksheet to which the headers will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported headers.

    ExportImageColumnCellToExcel(IRange, Object)

    Export a GridImageColumn to Excel.

    Declaration
    protected virtual void ExportImageColumnCellToExcel(IRange excelRange, object cellValue)
    Parameters
    Type Name Description
    IRange excelRange

    The Excel range to which the cell value will be exported.

    System.Object cellValue

    The value of the cell to be exported.

    ExportNumberFormatToExcel(IRange, IStyle, GridColumn, Object)

    Exports the format of the specified column in the SfDataGrid 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

    The format of the column in the SfDataGrid.

    GridColumn gridColumn

    The column in the SfDataGrid.

    System.Object cellValue

    The value of the cell in the column.

    ExportRecordCellToExcel(SfDataGrid, IRange, DataGridExcelExportOptions, Object, IPropertyAccessProvider, GridColumn)

    Exports the value of a record cell to an Excel range.

    Declaration
    protected virtual void ExportRecordCellToExcel(SfDataGrid dataGrid, IRange excelRange, DataGridExcelExportOptions excelExportOptions, object record, IPropertyAccessProvider propertyAccessProvider, GridColumn gridColumn)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the cell to be exported.

    IRange excelRange

    The Excel range to which the cell value will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to customize the Excel export process.

    System.Object record

    The record containing the cell to be exported.

    IPropertyAccessProvider propertyAccessProvider

    The PropertyAccessProvider used to access the properties of the record.

    GridColumn gridColumn

    The column of the cell to be exported.

    ExportRecordsToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions, IEnumerable, IPropertyAccessProvider, Group)

    Exports a set of records from the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportRecordsToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, IEnumerable records, IPropertyAccessProvider propertyAccessProvider, Group group)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the records to be exported.

    IWorksheet worksheet

    The worksheet to which the records will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported records.

    System.Collections.IEnumerable records

    The records to be exported.

    IPropertyAccessProvider propertyAccessProvider

    The PropertyAccessProvider used to access the properties of the records.

    Group group

    The group to which the records belong.

    ExportRecordToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions, Object, Int32, IPropertyAccessProvider)

    Exports a record from the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportRecordToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, object record, int startColumnIndex, IPropertyAccessProvider propertyAccessProvider)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the record to be exported.

    IWorksheet worksheet

    The worksheet to which the record will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported record.

    System.Object record

    The record to be exported.

    System.Int32 startColumnIndex

    The index of the first column in the record.

    IPropertyAccessProvider propertyAccessProvider

    The PropertyAccessProvider used to access the properties of the record.

    ExportRowStyle(IRange, IStyle, Int32)

    Exports the row style of a cell to an Excel range.

    Declaration
    protected virtual void ExportRowStyle(IRange excelRange, IStyle style, int rowIndex)
    Parameters
    Type Name Description
    IRange excelRange

    The Excel range where the row style will be exported.

    IStyle style

    The style of the row to be exported.

    System.Int32 rowIndex

    The index of the row that the style will be applied to.

    ExportStackedHeaderRowsToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions)

    Exports the stacked headers of the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportStackedHeaderRowsToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid
    IWorksheet worksheet

    The worksheet to which the stacked headers will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported stacked headers.

    ExportStackedHeaderRowToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions, StackedHeaderRow)

    Exports a stacked header of the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportStackedHeaderRowToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, StackedHeaderRow stackedHeaderRow)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the stacked header to be exported.

    IWorksheet worksheet

    The worksheet to which the stacked header will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported stacked header.

    StackedHeaderRow stackedHeaderRow

    The stacked header row to be exported.

    ExportSummaryCellToExcel(SfDataGrid, IRange, ExportCellType, String, Object, String, DataGridExcelExportOptions)

    Exports the summary display text for a given column in the SfDataGrid to an Excel range.

    Declaration
    protected virtual void ExportSummaryCellToExcel(SfDataGrid dataGrid, IRange summaryRange, ExportCellType exportCellType, string summaryDisplayText, object exportNodeEntry, string columnName, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the summary display text to be exported.

    IRange summaryRange

    The Excel range to which the summary display text will be exported.

    ExportCellType exportCellType

    The type of Excel cell to use for the export.

    System.String summaryDisplayText

    The summary display text to be exported.

    System.Object exportNodeEntry

    The Excel node entry used in the export process.

    System.String columnName

    The name of the column containing the summary display text.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported summary display text.

    ExportTableSummariesToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions, TableSummaryRowPosition)

    Exports the table summaries from the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportTableSummariesToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, TableSummaryRowPosition position)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the table summaries to be exported.

    ICollectionViewAdv view

    The collection of items in the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the table summaries will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set options that may affect the exported table summaries.

    TableSummaryRowPosition position

    The position at which the table summaries will be placed in the worksheet.

    ExportTableSummaryToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions, SummaryRecordEntry)

    Exports a table summary from the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportTableSummaryToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, SummaryRecordEntry summaryRecordEntry)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the table summary to be exported.

    ICollectionViewAdv view

    The collection of items in the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the table summary will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set options that may affect the exported table summary.

    SummaryRecordEntry summaryRecordEntry

    The summary record entry to be exported.

    ExportToExcel(SfDataGrid, ICollectionViewAdv, DataGridExcelExportOptions)

    Declaration
    public virtual ExcelEngine ExportToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid
    ICollectionViewAdv view
    DataGridExcelExportOptions excelExportOptions
    Returns
    Type
    ExcelEngine

    ExportToExcel(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions)

    Exports the data in the SfDataGrid to a specified worksheet in an Excel document.

    Declaration
    public virtual void ExportToExcel(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid whose data will be exported.

    ICollectionViewAdv view

    The view of the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the data will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to customize the Excel export process.

    ExportToExcel(SfDataGrid, ObservableCollection<Object>, DataGridExcelExportOptions)

    Declaration
    public virtual ExcelEngine ExportToExcel(SfDataGrid dataGrid, ObservableCollection<object> rows, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid
    System.Collections.ObjectModel.ObservableCollection<System.Object> rows
    DataGridExcelExportOptions excelExportOptions
    Returns
    Type
    ExcelEngine

    ExportToExcel(SfDataGrid, ObservableCollection<Object>, IWorksheet, DataGridExcelExportOptions)

    Declaration
    public virtual void ExportToExcel(SfDataGrid dataGrid, ObservableCollection<object> rows, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid
    System.Collections.ObjectModel.ObservableCollection<System.Object> rows
    IWorksheet worksheet
    DataGridExcelExportOptions excelExportOptions

    ExportToExcelWorksheet(SfDataGrid, ICollectionViewAdv, IWorksheet, DataGridExcelExportOptions)

    Exports the data in the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportToExcelWorksheet(SfDataGrid dataGrid, ICollectionViewAdv view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid whose data will be exported.

    ICollectionViewAdv view

    The view of the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the data will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options.

    ExportUnboundRowCellToExcel(SfDataGrid, IRange, DataGridExcelExportOptions, GridUnboundRow, GridColumn)

    Exports the value of a cell in an unbound row to Excel.

    Declaration
    protected virtual void ExportUnboundRowCellToExcel(SfDataGrid dataGrid, IRange excelRange, DataGridExcelExportOptions excelExportOptions, GridUnboundRow gridUnboundRow, GridColumn gridColumn)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the cell to be exported.

    IRange excelRange

    The Excel range to which the cell value will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported cell value.

    GridUnboundRow gridUnboundRow

    The unbound row containing the cell to be exported.

    GridColumn gridColumn

    The column of the cell to be exported.

    ExportUnboundRowsToExcel(SfDataGrid, ICollectionView, IWorksheet, DataGridExcelExportOptions, UnboundRowsPosition, Boolean, ObservableCollection<GridUnboundRow>)

    Exports unbound rows from the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportUnboundRowsToExcel(SfDataGrid dataGrid, ICollectionView view, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, UnboundRowsPosition position, bool belowSummary, ObservableCollection<GridUnboundRow> unboundRows = null)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the unbound rows to be exported.

    Microsoft.UI.Xaml.Data.ICollectionView view

    The view of the SfDataGrid.

    IWorksheet worksheet

    The worksheet to which the unbound rows will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported unbound rows.

    UnboundRowsPosition position

    The position of the unbound rows.

    System.Boolean belowSummary

    A flag indicating whether the unbound rows should be placed below or above the table summary.

    System.Collections.ObjectModel.ObservableCollection<GridUnboundRow> unboundRows

    The unbound rows to be exported.

    ExportUnboundRowToExcel(SfDataGrid, IWorksheet, DataGridExcelExportOptions, GridUnboundRow)

    Exports an unbound row from the SfDataGrid to an Excel worksheet.

    Declaration
    protected virtual void ExportUnboundRowToExcel(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions, GridUnboundRow gridUnboundRow)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid containing the unbound row to be exported.

    IWorksheet worksheet

    The worksheet to which the unbound row will be exported.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the exported unbound row.

    GridUnboundRow gridUnboundRow

    The unbound row to be exported.

    GetCellValue(Object, IPropertyAccessProvider, GridColumn, ExportMode)

    Gets the cell value for a record to be exported.

    Declaration
    protected virtual object GetCellValue(object record, IPropertyAccessProvider propertyAccessProvider, GridColumn gridColumn, ExportMode exportMode)
    Parameters
    Type Name Description
    System.Object record

    The record whose cell value will be obtained.

    IPropertyAccessProvider propertyAccessProvider

    The property access provider used to obtain the cell value.

    GridColumn gridColumn

    The column of the cell whose value will be obtained.

    ExportMode exportMode

    The mode in which the data is being exported.

    Returns
    Type Description
    System.Object

    The cell value to be exported.

    InitializeCellStyle(SfDataGrid, IWorksheet, DataGridExcelExportOptions)

    Initializes the style of cells in an Excel worksheet.

    Declaration
    protected virtual void InitializeCellStyle(SfDataGrid dataGrid, IWorksheet worksheet, DataGridExcelExportOptions excelExportOptions)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid to be exported.

    IWorksheet worksheet

    The worksheet whose cells will be initialized.

    DataGridExcelExportOptions excelExportOptions

    An instance of the DataGridExcelExportOptions class, used to set export options that may affect the style of the cells.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved