RadPivot Grid Data export

1 Answer 46 Views
PivotGrid and PivotFieldList
Mayank
Top achievements
Rank 1
Mayank asked on 05 Mar 2023, 04:54 PM

Hello,

I am trying to export a radPivotGrid into excel as per the documentation

 

 private void radButton1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sf = new SaveFileDialog();
            sf.Filter = "EXCEL | .xls";
            if (sf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Telerik.WinControls.UI.Export.ExportToExcelML htmlexport = new Telerik.WinControls.UI.Export.ExportToExcelML(radPivotGrid_StockPositionPivot);
                //  htmlexport.RunExport(sf.FileName);


                PivotGridSpreadExport spreadExport = new PivotGridSpreadExport(radPivotGrid_StockPositionPivot);
                spreadExport.RunExport(@"..\..\exported-file.xlsx", new SpreadExportRenderer());
            }
        }

 

the red marked position is throwing an exception, and code suggestion is asking to create a new class to implement SpreadExortRenderer I am not sure how it can be done, any help will be appreciated. TIA

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Mar 2023, 11:06 AM

Hello, Mayank,

The spread export functionality is located in the TelerikExport.dll assembly.You need to include the following namespace in order to access the types contained in TelerikExport:

Telerik.WinControls.TelerikExport

            SaveFileDialog sf = new SaveFileDialog();
            sf.Filter = "EXCEL | .xls";
            if (sf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                PivotGridSpreadExport spreadExport = new Telerik.WinControls.Export.PivotGridSpreadExport(this.radPivotGrid1);
                spreadExport.RunExport(@"..\..\exported-file.xlsx", new Telerik.WinControls.Export.SpreadExportRenderer());
            }

Since this functionality is using the RadSpreadProcessingLibrary you need to reference the following assemblies as well:

Telerik.Windows.Documents.Core
Telerik.Windows.Documents.Fixed
Telerik.Windows.Documents.Spreadsheet
Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml
Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf
Telerik.Windows.Zip

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PivotGrid and PivotFieldList
Asked by
Mayank
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or