Disabling rows to be exported according to a condition

2 posts, 0 answers
  1. Ueli
    Ueli avatar
    5 posts
    Member since:
    Dec 2013

    Posted 30 May 2014 Link to this post

    Hi,

    I just wonder whether it would be directly possible to have certains rows not exported based on a condition I set or whether I need to exclude them manually.

    Ueli
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 31 May 2014 Link to this post

    Hi Ueli,

    Thank you for writing.

    To exclude a row from being exported, you need to set its IsVisible property to false and the exporter's HiddenRowOption to DoNotExport:
    private void radButton1_Click(object sender, EventArgs e)
    {
        ExportToExcelML exporter = new ExportToExcelML(this.radGridView1);
        exporter.HiddenRowOption = HiddenOption.DoNotExport;
      
        string fileName = "C:\\ExportedData123.xls";
      
        foreach (var item in radGridView1.Rows)
        {
            item.IsVisible = false;  
        }
      
        exporter.RunExport(fileName);
      
        foreach (var item in radGridView1.Rows)
        {
            item.IsVisible = true;
        }
    }

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top