I couldn't sfDataGrid export PDF or EXCEL

Hi,

I am reviewing the link address below. But I couldn't export.
https://help.syncfusion.com/xamarin/datagrid/export-to-pdf#see-also


DataGridPdfExportingController pdfExport = new DataGridPdfExportingController();
            MemoryStream stream = new MemoryStream();
            var exportToPdf = pdfExport.ExportToPdf(this.dtGelir, new DataGridPdfExportOption()
            {
                FitAllColumnsInOnePage = true,
            });
            exportToPdf.Save(stream);
            exportToPdf.Close(true);
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
                Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("DataGrid.pdf", "application/pdf", stream);
            else
                Xamarin.Forms.DependencyService.Get<ISave>().Save("DataGrid.pdf", "application/pdf", stream);

          * What is the DataGridPdfExportingController mentioned in the example? how do i add to the project?
          

Attachment: Ek_Açıklama_20200512_220540_12874dd8.rar

3 Replies

KK Karthikraja Kalaimani Syncfusion Team May 13, 2020 01:12 PM UTC

 
Hi Hamit,

We have looked your screenshot and we suspect that you have installed Syncfusion.Xamarin.DataGridExport nuget in your project. So, only its throwing error. So, install that package from nuget.org. Then you have not created interface class for ISave and ISaveWindowsPhone. So only error throwing on ISave and ISaveWindowsPhone. Please refer the UG link to Create a interface class and renderer class for ISave and ISaveWindowsPhone.

UG link : https://help.syncfusion.com/xamarin/datagrid/export-to-pdf#saving-options

Regards,
Karthik Raja



HA hamit May 13, 2020 08:43 PM UTC

Thank you for the answer. But then there were other problems and I solved them.
1-) It is necessary to add provider_paths.xml, this is in your other examples.
2-) Runtime permission was required to use the FileOutputStream object.
There are a few more things, but I can't write them all.

I solved all the problems works fine.

NOTE: As a result, perhaps it may not be your responsibility to provide this information, but I think it would be more efficient if you put at least one of the current working examples.

Sorry for my bad english (google translate 😊)


KK Karthikraja Kalaimani Syncfusion Team May 14, 2020 02:12 PM UTC

Hi Hamit,

Thanks for the update.

We glad to know that your requirement has been achieved. Please let us know if you have any further queries on this. We are happy to help you.

As you requested you can see the sample for export on See Also tab on same page.
https://help.syncfusion.com/xamarin/datagrid/export-to-pdf#see-also


Regards,
Karthik Raja

 


Loader.
Up arrow icon