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
1800
Ultragrid new row with custom text
posted

I have a ultrawinGrid  which is populated after a search click. The results are exported to excel using UltraGridExcelExporter. User needs a row in the excel that would display the selected criteria in the search screen.

It is like., an excel report is generated and the last row (after some empty rows..) should read as,

Paramters Selected: <value1>, <value2> etc...

Is that possible?

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi,

    This should be possible, but there's no built-in way to do it automatically. You will have to code it.

    I would do something like this:


            private void ultraGridExcelExporter1_EndExport(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.EndExportEventArgs e)
            {
                StringBuilder sb =new StringBuilder();
                sb.Append("Parameters Selected: ");
                UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
                foreach (UltraGridColumn column in band.Columns)
                {
                    foreach (FilterCondition filterCondition in band.ColumnFilters[column].FilterConditions)
                    {
                        if (sb.Length > "Parameters Selected: ".Length)
                            sb.Append(", ");

                        sb.Append(filterCondition.ToString());
                    }
                }
                e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = sb.ToString();
            }

Children