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
3045
How to exclude AddRow from export?
posted

I'm trying to exclude the AddRow from the Excel/PDF export, so I am trying to check the IsAddRow property of the e.GridRow inside the RowExporting event. Basically, I want to exclude uncommitted row.

The only thing is that the e.GridRow.IsAddRow is always false, but the corresponding row from the grid's row collection (DisplayLayout.Rows) itself has the property correctly set as true.

I tried using the e.GridRow.Index to check the property from grid's row itself. This works fine when the grid is not grouped. Once grid is grouped (Outlook Group-by), there is no longer an easy way to reference the grid's row.

I'm using v9.2. Also use a menu or context menu (not a button) to initiate the export so the AddRow will not commit its data. 

  • 469350
    Verified Answer
    Offline posted

    Hi,

    The rows in the export are clones of the original rows. So I guess it can't copy over the state of the row for something like an AddRow.

    So what you have to do is look at the real row that is associated with the cloned row.


            private void ultraGridExcelExporter1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportInitializeRowEventArgs e)
            {
                UltraGrid grid = (UltraGrid)e.Row.Band.Layout.Grid;
                UltraGridRow realGridRow = grid.GetRowFromPrintRow(e.Row);
                if (realGridRow.IsAddRow)
                    e.SkipRow = true;
            }