Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
Excelexport of multiband grid, do not export hidden rows...
posted

Hi,

I have a multiband grid and want to export it. It should be possible to export either that what you can see on screen or even the child rows of collapsed rows that are not vsible on screen.

By default, excel export exports all rows. So I want to organize, that the child rows of collapsed rows will be ignored.

I tried this (but it does not work):

private  void GridExcelExportRowExporting (object sender, RowExportingEventArgs e)

{

    e.Cancel = !grid.GetRowFromPrintRow (e.GridRow).Hidden;

}

I tried even this:

private void GridExcelExportRowExporting (object sender, RowExportingEventArgs e)

{

    if (!boExportHiddenRowsC)

        if (!e.GridRow.Expanded)

        {

            var gridRow = e.GridRow.GetChild (ChildRow.First);

            while (gridRow != null)

            {

                var gridRowTemp = gridRow.HasNextSibling () ? gridRow.GetSibling (SiblingRow.Next) :  null;

                gridRow.Delete (false);

                gridRow = gridRowTemp;

            }

        }

}

I hoped, that I can do this, because excel export uses a clone of the grid on form, but the child rows of my collapsed rows on screen are deleted and my data is killed :-(

Can anyone show me the right way to solve my problem please!?

Torben

Parents
No Data
Reply
  • 270
    Verified Answer
    posted

    Finally I have found the solution by myself :-)

    private void gridExcelExport_InitializeRow (object sender, ExcelExportInitializeRowEventArgs e)

    {

        if (!boExportHiddenRowsC)

            e.SkipDescendants = !e.Row.Expanded;

    }

Children
No Data