Page 1 of 1

Hide DataBand or Table when export to CSV

Posted: Mon Sep 19, 2016 10:38 am
by NicolasM
Hello,

I would like to know if it's possible to hide entire DataBand or table object when exporting to CSV format. Maybe by using tag??

Thanks in advance.

Niko

Re: Hide DataBand or Table when export to CSV

Posted: Tue Sep 20, 2016 6:59 am
by Alex K.
Hello,

As a way, you can use the additional code in the Exporting event of the report for disabling necessary component.
For example:

Code: Select all

DataBand1.Enabled = false;
this.Render(false);
Thank you.

Re: Hide DataBand or Table when export to CSV

Posted: Tue Sep 20, 2016 10:09 am
by NicolasM
Hello Aleksey,

Thank you for your help. Works fine! I create a generic method for all my reports with this.
If anyone needs (my main table is called 'Table'):

Code: Select all

/// <summary> 
/// This method can be used before Render() to prepare report for CSV export. All components except 'Table' is disabled.
/// </summary>
public void PrepareForCsvExport()
{
    StiComponentsCollection stiColl = _stiReport.GetComponents();

    foreach( StiComponent comp in stiColl )
    {
        if( comp.ToolboxCategory == StiToolboxCategory.Bands )
        {
            if( comp.Name != "Table" ) comp.Enabled = false;
        }
    }
}

Re: Hide DataBand or Table when export to CSV

Posted: Tue Sep 20, 2016 8:59 pm
by Alex K.
Hello

We are always glad to help you!
Let us know if you need any additional help.

Thank you.