How to export to excel a RadProgressBarElement in a grid column?

1 Answer 68 Views
GridView ProgressBar
Fabien
Top achievements
Rank 1
Fabien asked on 09 Nov 2023, 12:34 PM

Hello,

In my gridview, I have a  progressBarElement in a grid column as explained here:

https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells?_gl=1*d7lc04*_gcl_au*MTgwMTc5NzcyMS4xNjk5NTI4NjIw*_ga*OTQ3ODE2NTUuMTY5MTU3MzE4Nw..*_ga_9JSNBCSF54*MTY5OTUyODYyMC4xNS4xLjE2OTk1MzMwODcuMzUuMC4w&_ga=2.222397211.1249884809.1699528621-94781655.1691573187

When I export, I don't have the progress bar, only values



 private void RunExportToExcelML(string fileName, ref bool openExportFile)
        {
            ExportToExcelML excelExporter = new ExportToExcelML(this.radGridView1)
            {
                SheetName = "Essai",
                SummariesExportOption = SummariesOption.ExportAll,
                SheetMaxRows = ExcelMaxRows._65536,
                ExportVisualSettings =true,
                
                
                
            };

            try
            {
                excelExporter.RunExport(fileName);

                RadMessageBox.SetThemeName(this.radGridView1.ThemeName);
                DialogResult dr = RadMessageBox.Show("The data in the grid was exported successfully. Do you want to open the file?",
                    "Export to Excel", MessageBoxButtons.YesNo, RadMessageIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    openExportFile = true;
                }
            }
            catch (IOException ex)
            {
                RadMessageBox.SetThemeName(this.radGridView1.ThemeName);
                RadMessageBox.Show(this, ex.Message, "I/O Error", MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Nov 2023, 08:14 PM

Hello, Fabien,

The ExportToExcelML used in your code snippet is quite an old approach for exporting to Excel format. A better option is the GridViewSpreadExport which utilizes our RadSpreadProcessing library to export the content of RadGridView to xlsx, csv, pdf and txt formats. More information is available here:

https://docs.telerik.com/devtools/winforms/controls/gridview/exporting-data/spread-export 

However, please have in mind that creating the custom cells is supported in the RadGridView control and its internal elements structure thanks to the Telerik Presentation Framework which builds the control. Hence, any custom implementation in the UI at run time is not observed in the exported file out of the box.

One possible approach is replace the progress bars with an appropriate image inserted in the appropriate cell. Please give it a try and see how it works on your end.

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
GridView ProgressBar
Asked by
Fabien
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or