This is a migrated thread and some comments may be shown as answers.

RadGridViewExcelExporter with formatting / filtering + VirtualMode

9 Answers 306 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Geir Aage Amundsen
Top achievements
Rank 1
Geir Aage Amundsen asked on 26 Mar 2008, 02:47 PM
Hello!
Many of my users would like to export formatted / filtered data from a datagrid and into Excel. Is there any way of solving this?

Does the datagrid support VirtualMode? I could not find any property similar to this. Or any event similar to the default DataGridViews's CellValueNeeded.

If it is not possible in this version, I would like to send a request for it.

9 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 26 Mar 2008, 04:49 PM
Hello Geir,

Thank you for contacting us.

Yes, RadGridView supports Export to Excel functionality. There is an example in our Quick Start Framework named "Export to Excel". Take a look at it.

Because other Telerik products need the same feature, we plan to implement a common solution with extended functionality. We will add support for virtual mode in RadGridView in our upcoming release Q1 2008.

Do not hesitate to write me, if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Geir Aage Amundsen
Top achievements
Rank 1
answered on 27 Mar 2008, 08:03 AM
Hello again!
To clearify my first question.

I have already implemented the export to Excel-function. And it works great. But my users often filters and groups directly in the RadGridView. Is it possible to export the filtered and grouped RadGridView to Excel?

The sample I found just exports a plain RadGridView, but the filtering and grouping is lost.

Sindre
0
Jack
Telerik team
answered on 27 Mar 2008, 02:04 PM
Hi Geir,

Currently, the Export to Excel functionality supports filtering, but not grouping or hierarchy. This feature will receive more attention following the Q1 2008 release.

Do not hesitate to write me, if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kris
Top achievements
Rank 1
answered on 24 Apr 2008, 11:23 PM
Where is the Quick Start Framework with Excel to Export example?? I can't seem to find it.
0
Martin Vasilev
Telerik team
answered on 25 Apr 2008, 12:29 PM
Hi Kris,

Thank you for writing.

To run the Quick Start Framework from your Windows Start Menu navigate to Programs\Telerik\Rad Controls for WinForms Q1 2008\Rad Controls for WinForms Examples. Once the application starts, locate RadGridView in the navigation, expand it and click on Export to Excel.

I hope this helps. If you have other questions, do not hesitate to contact me again.

 
Regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Prad
Top achievements
Rank 2
answered on 09 Jun 2008, 10:48 PM
I am unable to find the assembly for

RadGridViewExcelExporter

Which namespace do I need to add in order to get this functionality?

Pradeep

0
Martin Vasilev
Telerik team
answered on 12 Jun 2008, 07:36 AM
Hello Pradeep,

I have already replied in your support ticket, but I think it is a good idea to also post the information in the forum:

The RadGridViewExcelExporter class is a member of the Telerik.Data assembly. You have to add a reference to this assembly in your project in order to be able to access the class. The assembly could be found in the RadControls install directory, which by default is: C:\Program Files\Telerik\RadControls for WinForms Q1 2008 SP1\bin.


If you have other questions, do not hesitate to contact me again.

Best wishes,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kris
Top achievements
Rank 1
answered on 10 Jul 2008, 04:01 PM
I have a Radgridview with 5 columns visible and 15 more columns invisible. When the user exports the grid to excel, I want to export all columns. From what I have noticed so far, the exporter only exports visible columns. So what I am trying to do is to make all columns visible, then hide the grid completely(as all the columns will be real tiny, and really bad looking), then export with all columns, then hide columns again, and finally show the grid. But it seems that the grid also has to be visible to export. Is there any way I can accomplish this? Any help is much appreciated. Thanks.

0
Martin Vasilev
Telerik team
answered on 14 Jul 2008, 11:12 AM
Hi Kris,

Thank you for the question.

Currently, TelerikData can export only the visible columns and this behavior cannot be changed. Nevertheless, you approach for showing all columns, process export and hide them again is correct. To avoid displaying all columns in that process you could use BeginUpdate and EndUpdate methods of GridElement. Please review the code block below as reference: 
private void radButtonExport_Click(object sender, EventArgs e) 
    this.radGridView1.GridElement.BeginUpdate(); 
     
    foreach (GridViewColumn col in this.radGridView1.Columns) 
    { 
        col.IsVisible = true
    } 
 
    saveFileDialog1.Filter = "Excel (*.xls)|*.xls";  
    if (saveFileDialog1.ShowDialog() == DialogResult.OK)  
    {  
        if (!saveFileDialog1.FileName.Equals(String.Empty))  
        { 
            FileInfo file = new FileInfo(saveFileDialog1.FileName);  
            if (file.Extension.Equals(".xls")) 
            {  
                Export(saveFileDialog1.FileName);  
            }  
            else  
            {  
                MessageBox.Show("Invalid file type"); 
            }  
        }  
        else  
        {  
            MessageBox.Show("Please enter a file name.");  
        }  
    } 
 
    for (int i = 3; i < this.radGridView1.ColumnCount; i++) 
    { 
        this.radGridView1.Columns[i].IsVisible = false
    } 
 
    this.radGridView1.GridElement.EndUpdate(); 
 
    MessageBox.Show("Export finished"); 

I hope this helps. If you have other questions, do not hesitate to contact me again.

Kind regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Geir Aage Amundsen
Top achievements
Rank 1
Answers by
Jack
Telerik team
Geir Aage Amundsen
Top achievements
Rank 1
Kris
Top achievements
Rank 1
Martin Vasilev
Telerik team
Prad
Top achievements
Rank 2
Share this question
or