Class DataGridExcelExportingOption
Class which is used to set the exporting options for the excel. User can pass this class as an argument to the ExportToExcel(SfDataGrid, DataGridExcelExportingOption) for customizing data exported to the excel.
Inheritance
Namespace: Syncfusion.SfDataGrid.XForms.Exporting
Assembly: Syncfusion.SfGridConverter.XForms.dll
Syntax
public class DataGridExcelExportingOption : Object
Constructors
DataGridExcelExportingOption()
Initializes a new instance of the DataGridExcelExportingOption class.
Declaration
public DataGridExcelExportingOption()
Properties
AllowOutlining
Gets or sets a value indicating whether the groups in the SfdataGrid should export with expand/collapse options or not.
Declaration
public bool AllowOutlining { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The boolean value indicating whether the groups in the SfdataGrid should export with expand/collapse options or not. True if the SfdataGrid should export the groups with expand/collapse option, otherwise false. The default value is false. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption();
exportOption.AllowOutlining = true;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
AllowSortingAndFiltering
Gets or sets a value indicating whether it is needed to apply excel filtering and sorting for the exported file.
Declaration
public bool AllowSortingAndFiltering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The boolean value specifying whether it is needed to apply excel filtering and sorting for the exported file. By default the value is false. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.AllowSortingAndFiltering = true;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ApplyGridStyle
Gets or sets a value indicating whether the grid style of the SfdataGrid need to be exported or not.
Declaration
public bool ApplyGridStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value specifying whether the grid style of the SfdataGrid need to be exported or not. The default value is false. |
Remarks
Grid Styles are not exported when user sets the properties like GroupCaptionStyle, HeaderStyle, RecordStyle, etc for exporting.
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption();
exportOption.ApplyGridStyle = true;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
BottomTableSummaryStyle
Gets or sets the style to be applied for the exporting bottom table summaries in the grid.
Declaration
public ExportCellStyle BottomTableSummaryStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting bottom table summaries in the grid. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.BottomTableSummaryStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Bold = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
DefaultColumnWidth
Gets or sets the default column width for exporting. The default column width will be applied for exporting when ExportColumnWidth is false.
Declaration
public int DefaultColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default column width for exporting. The default value is 50. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.DefaultColumnWidth = 60;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
DefaultRowHeight
Gets or sets the default row height for exporting. The default row height will be applied for exporting when ExportRowHeight is false.
Declaration
public int DefaultRowHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default row height for exporting. The default value is 50. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.DefaultRowHeight = 60;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExcelColumnIndex
Gets or internal sets the index of the column being exported to the excel. Each column is exported based on this index, which enable to identify current exporting column index.
Declaration
public int ExcelColumnIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the column being exported to the excel. |
ExcelRowIndex
Gets the index of the row being exported to the excel. Each row is exported based on this index, which enable to identify current exporting row index.
Declaration
public int ExcelRowIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the row being exported to the excel. |
ExcelVersion
Gets or sets the excel version for exporting the data to the excel. The user can customize the exporting workbook version by using this property.
Declaration
public ExcelVersion ExcelVersion { get; set; }
Property Value
Type | Description |
---|---|
ExcelVersion | The excel workbook version in which the data in the grid is to be exported. The default value is Excel2013. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption();
exportOption.ExcelVersion = ExcelVersion.Excel2010;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExcludedColumns
Gets or sets the list of columns that to be excluded from exporting.
Declaration
public List<string> ExcludedColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The list of columns that to be excluded from exporting. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExcludedColumns.Add("CustomerID");
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportAllPages
Gets or sets a value indicating whether all the pages in the SfDataPager should be exported or not.
Declaration
public bool ExportAllPages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The boolean value specifying whether all the pages in the SfDataPager should be exported or not. The default value is false. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportAllPages = true;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportColumnWidth
Gets or sets a value indicating whether the column widths can be exported or not, if not default column width will be assigned.
Declaration
public bool ExportColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value whether the column widths can be exported or not, if not default column width will be assigned. The default value is true. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportColumnWidth = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportGroups
Gets or sets a value indicating whether the groups in the SfdataGrid is to be exported or not.
Declaration
public bool ExportGroups { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value specifying whether the groups in the SfdataGrid is to be exported or not. The default value is true. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportGroups = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportGroupSummary
Gets or sets a value indicating whether the group summary rows should be exported or not.
Declaration
public bool ExportGroupSummary { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The boolean value specifying whether the group summary rows should be exported or not. The default value is true. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportGroupSummary = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportHeader
Gets or sets a value indicating whether the header is to be exported or not.
Declaration
public bool ExportHeader { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value specifying whether the header is to be exported or not. By default the value is true. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportHeader = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportMode
Gets or sets the export mode specifying whether the data in the grid should exported as value or text.
Declaration
public ExportMode ExportMode { get; set; }
Property Value
Type | Description |
---|---|
ExportMode | The ExportMode specifying whether the data in the grid should exported as value or text. The default value is Text. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportMode = ExportMode.Value;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportRowHeight
Gets or sets a value indicating whether the row heights can be exported or not, if not default row height will be assigned.
Declaration
public bool ExportRowHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value specifying whether the row heights can be exported or not, if not default row height will be assigned. The default value is true. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportRowHeight = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportStackedHeaders
Gets or sets a value indicating whether the
Declaration
public bool ExportStackedHeaders { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value specifying whether the |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportStackedHeaders = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportTableSummary
Gets or sets a value indicating whether the table summary rows should be exported or not.
Declaration
public bool ExportTableSummary { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The boolean value specifying whether the table summary rows should be exported or not. The default value is true. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportTableSummary = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
ExportUnboundRows
Gets or sets the value which indicates whether the UnboundRows should be exported or not
Declaration
public bool ExportUnboundRows { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if UnboundRows should be exported; otherwise, false.The default value is false |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.ExportUnboundRows = false;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
GridColumns
Gets or internal sets the System.Collections.IEnumerable columns collection containing all the columns in the SfdataGrid excluding the columns in the ExcludedColumns list.
Declaration
public IEnumerable<GridColumn> GridColumns { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<GridColumn> | The System.Collections.IEnumerable columns collection containing all the columns in the SfdataGrid excluding the columns in the ExcludedColumns list. |
GroupCaptionStyle
Gets or sets the style to be applied for the exporting group caption summaries in the grid.
Declaration
public ExportCellStyle GroupCaptionStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting group caption summaries in the grid. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.GroupCaptionStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Bold = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
GroupSummaryStyle
Gets or sets the style to be applied for the exporting group summaries in the grid.
Declaration
public ExportCellStyle GroupSummaryStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting group summaries in the grid. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.GroupSummaryStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Bold = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
HeaderStyle
Gets or sets the style to be applied for the exporting header in the grid.
Declaration
public ExportCellStyle HeaderStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting header in the grid. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.HeaderStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Bold = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
RecordStyle
Gets or sets the style to be applied for the exporting record in the grid.
Declaration
public ExportCellStyle RecordStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting record in the grid. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.RecordStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Italic = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
Sheet
Gets the excel sheet for exporting the data in the grid.
Declaration
public IWorksheet Sheet { get; }
Property Value
Type | Description |
---|---|
IWorksheet | The excel sheet for exporting the data in the grid. |
StackedHeaderStyle
Gets or sets the style to be applied for the exporting
Declaration
public ExportCellStyle StackedHeaderStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption();
exportOption.StackedHeaderStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Bold = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
StartColumnIndex
Gets or sets the starting column index of the excel from which the data in the grid is to be exported.
Declaration
public int StartColumnIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The starting column index of the excel from which the data in the grid is to be exported. The default value is 1. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption();
exportOption.StartColumnIndex = 5;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
StartRowIndex
Gets or sets the starting row index of the excel from which the data in the grid is to be exported.
Declaration
public int StartRowIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The starting row index of the excel from which the data in the grid is to be exported. The default value is 1. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption();
exportOption.StartRowIndex = 5;
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);
TopTableSummaryStyle
Gets or sets the style to be applied for the exporting top table summaries in the grid.
Declaration
public ExportCellStyle TopTableSummaryStyle { get; set; }
Property Value
Type | Description |
---|---|
ExportCellStyle | The style to be applied for the exporting top table summaries in the grid. |
Examples
DataGridExcelExportingController excelExport = new DataGridExcelExportingController();
DataGridExcelExportingOption exportOption = new DataGridExcelExportingOption ();
exportOption.TopTableSummaryStyle = new ExportCellStyle()
{
BackgroundColor = Xamarin.Forms.Color.Accent,
BorderColor = Xamarin.Forms.Color.Red,
FontInfo = new ExportFontInfo() { Bold = true },
ForegroundColor = Xamarin.Forms.Color.Red
};
var excelEngine = excelExport.ExportToExcel (this.dataGrid, exportOption);