You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MAUI/DataGrid/export-to-excel.md
+82-5Lines changed: 82 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ To export the SfDataGrid to an Excel file, the following NuGet package should be
26
26
</table>
27
27
28
28
## Save Service class in portable project.
29
-
Add the new class file with name as SaveService to the Project and add below code in it. This is the helper class used to save and view the excell file in Windows, Android, IOS and MAC devices.
29
+
Add the new class file with name as SaveService to the Project and add below code in it. This is the helper class used to save and view the excel file in Windows, Android, iOS and MAC devices.
30
30
31
31
{% tabs %}
32
32
{% highlight c# %}
@@ -228,9 +228,9 @@ Add the following code to the AndroidManifest.xml file located under Properties
228
228
{% endhighlight %}
229
229
{% endtabs %}
230
230
231
-
### Save and View the Excel document in IOS
231
+
### Save and View the Excel document in iOS
232
232
233
-
Add the new class file with name SaveIOS file under Platforms -> IOS directory to save and view the Excell document in the IOS device and use the below code in it.
233
+
Add the new class file with name SaveIOS file under Platforms -> iOS directory to save and view the Excel document in the iOS device and use the below code in it.
234
234
235
235
{% tabs %}
236
236
{% highlight c# %}
@@ -356,7 +356,7 @@ namespace GettingStarted
356
356
357
357
### Save and View the Excel document in MacCatalyst
358
358
359
-
Add the new class file with name SaveMAC file under Platforms -> MacCatylyst directory to save and view the Excel document in the MAC Device and use the below code in it.
359
+
Add the new class file with name SaveMAC file under Platforms -> MacCatalyst directory to save and view the Excel document in the MAC Device and use the below code in it.
By default, [DetailsViewDataGrid](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DetailsViewDataGrid.html) will not be exported to Excel. You can export `DetailsViewDataGrid` by setting `CanExportDetailsView` property as true. You can customize its exporting operation by using `DataGridChildExcelExportingEventArgs`.
1059
+
1060
+
## Excluding DetailsViewDataGrid while exporting
1061
+
1062
+
You can exclude particular DetailsViewDataGrid while exporting by using the `DataGridChildExcelExportingEventArgs.Cancel` property.
<imgalt="Excluding specific DetailsView while exporting to Excel in DataGrid "src="Images\export-to-excel\maui-datagrid-detailsviewexporting.png"Width="404"/>
1091
+
1092
+
Here, `DetailsViewDataGrid` is not exported for the parent record having OrderID as 1002.
1093
+
1094
+
## Customizing DetailsViewDataGrid cells
1095
+
1096
+
Similar to the parent DataGrid, you can also customize the cells of the DetailsViewDataGrid using the [DataGridCellExcelExportingEventArgs](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.Exporting.DataGridCellExcelExportingEventArgs.html). By utilizing the `DataGridCellExcelExportingEventArgs.DetailsViewDefinition` property, you can identify the specific DetailsViewDataGrid and make your customizations.
<imgalt="Customizing DetailsViewDataGrid while exporting to Excel in DataGrid"src="Images/export-to-excel/maui-datagrid-customize-detailsview-excel.png"Width="404"/>
<imgalt="Export DataGrid to PDF format with customized cell style"src="Images\export-to-pdf\maui-datagrid-style-based-on-column-name.png"width="689"/>
1147
+
<imgalt="Export DataGrid to PDF format with customized cell style"src="Images\export-to-pdf\maui-datagrid-style-based-on-column-name.png"width="689"/>
1148
+
1149
+
### Exporting DetailsView
1150
+
1151
+
By default, [DetailsViewDataGrid](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DetailsViewDataGrid.html) will not be exported to PDF. You can export `DetailsViewDataGrid` by setting `CanExportDetailsView` property as true.
<imgsrc="Images/export-to-pdf/maui-datagrid-exportdetailsview.png"alt="Maui DataGrid displays Nested dataGrid exported to PDF"width="404"/>
1165
+
1166
+
By default, only expanded DetailsViewDataGrids will be exported to the PDF document. If you want to export all the DetailsViewDataGrids, you need to set `CanExportAllDetails` to true.
<imgsrc="Images\export-to-pdf\maui-datagrid-exportalldetails.png"alt="Nested dataGrid exported to PDF"width="404"/>
1181
+
1182
+
Here, first record only expanded in SfDataGrid. But all the DetailsViewDataGrid’s are shown in exported PDF document.
1183
+
1184
+
You can customize its exporting operation by using `DataGridChildPdfExportingEventArgs`.
1185
+
1186
+
N> While exporting DetailsViewDataGrid, `CanFitAllColumnInOnePage` is set to true internally as horizontal pagination is not supported for DetailsViewDataGrid.
1187
+
1188
+
## Excluding DetailsViewDataGrid while exporting
1189
+
1190
+
You can exclude particular DetailsViewDataGrid while exporting, by using the `DataGridChildPdfExportingEventArgs.Cancel`.
<imgalt="Excluding specific DetailsView while exporting to PDF in DataGrid "src="Images/export-to-pdf/maui-datagrid-excluderows.png"Width="404"/>
1216
+
1217
+
Here, `DetailsViewDataGrid` is not exported for the parent record having OrderID as 1002.
1218
+
1219
+
## Customizing DetailsViewDataGrid cells
1220
+
1221
+
Similar to the parent DataGrid, you can also customize the cells of the DetailsViewDataGrid by using the DataGridCellPdfExportingEventArgs. By utilizing the `DataGridCellPdfExportingEventArgs.DetailsViewDefinition` property, you can identify the specific DetailsViewDataGrid and customize it accordingly.
<imgalt="Customizing DetailsViewDataGrid while exporting to PDF in DataGrid"src="Images/export-to-pdf/maui-datagrid-customize-detailsview.png"Width="404"/>
0 commit comments