RadGridView Exporting to Excel Problem

7 posts, 0 answers
  1. Chandu
    Chandu avatar
    23 posts
    Member since:
    Jul 2012

    Posted 26 Jul 2012 Link to this post


    Hello All

    In my silverLight application am using telerik Radgridview.
    what my problem is 
    i need to export only selected rows of gridview to Excel sheet.

    Please help me regarding this

    thanq
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 26 Jul 2012 Link to this post

    Hi ,

    You need to handle the ElementExporting event. Inside the handler you can check what element is being exported and in case it is not in the selected ones , just set e.Cancel = true.


    All the best,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Chandu
    Chandu avatar
    23 posts
    Member since:
    Jul 2012

    Posted 26 Jul 2012 Link to this post

    Hello Pavel

     I have implemented ElementExporting as follows but am unable to get selected records.
    could you give a code snippet for this anyway thanks

             private void RadGrdWorkOrders_ElementExporting(object sender, GridViewElementExportingEventArgs e)
            {
                if (e.Element == ExportElement.HeaderRow || e.Element == ExportElement.FooterRow || e.Element == ExportElement.GroupFooterRow)
                {
                    e.Background = Colors.Blue; //HeaderBackgroundPicker.SelectedColor;
                    e.Foreground = Colors.Orange; //HeaderForegroundPicker.SelectedColor;
                    e.FontSize = 20;
                    e.FontWeight = FontWeights.Bold;
                }
                else if (e.Element == ExportElement.Row)
                {
                    e.Background = Colors.White;// RowBackgroundPicker.SelectedColor;
                    e.Foreground = Colors.Magenta; //RowForegroundPicker.SelectedColor;
                }
                else if (e.Element == ExportElement.Cell &&
                    e.Value != null && e.Value.Equals("Chocolade"))
                {
                    e.FontFamily = new FontFamily("Verdana");
                    e.Background = Colors.LightGray;
                    e.Foreground = Colors.Blue;
                }
                else if (e.Element == ExportElement.GroupHeaderRow)
                {
                    e.FontFamily = new FontFamily("Verdana");
                    e.Background = Colors.LightGray;
                    e.Height = 30;
                }
                else if (e.Element == ExportElement.GroupHeaderCell &&
                    e.Value != null && e.Value.Equals("Chocolade"))
                {
                    e.Value = "MyNewValue";
                }
                else if (e.Element == ExportElement.GroupFooterCell)
                {
                    GridViewDataColumn column = e.Context as GridViewDataColumn;
                    QueryableCollectionViewGroup qcvGroup = e.Value as QueryableCollectionViewGroup;


                    if (column != null && qcvGroup != null && column.AggregateFunctions.Count() > 0)
                    {
                        //e.Value = GetAggregates(qcvGroup, column);
                    }
                }




            }


  5. Kathleen
    Kathleen avatar
    1 posts
    Member since:
    Sep 2013

    Posted 04 Nov 2013 Link to this post

    In the latest Teleric relesae Q3 2013 we get the following warning:

    Warning 2 'Telerik.Windows.Controls.GridViewElementExportingEventArgs.Foreground' is obsolete: '"This property is obsolete and it will be removed with Q1 2014. It is only supported when export format is HTML, so please, use (VisualParameters as GridViewHtmlVisualParameters).Foreground instead"' 

    So while doing export to Excel, will there be any other approach recommeded?

    Thanks
  6. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 07 Nov 2013 Link to this post

    Hello Kathleen,

    We made some changes to the API with Q3 2013 version. You can check this help topic for more information. Please let us know if you have additional questions.

    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  7. Senthilselvi
    Senthilselvi avatar
    4 posts
    Member since:
    Apr 2012

    Posted 12 Dec 2014 in reply to Yordanka Link to this post

    The link you have provided is not working. Please let me know the option.
  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Dec 2014 Link to this post

    Hi,

    You can find the correct link here: Export Events.

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner