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
520
UltraWebGrid ExcelExporter HeaderRowExporting event issue
posted

I have an issue with changes to header captions made in HeaderRowExporting event not reflecting in the exported excel file.  

 

            exportControl.XLSExport.HeaderRowExporting += new Infragistics.WebUI.UltraWebGrid.ExcelExport.HeaderRowExportingEventHandler(XLSExport_HeaderRowExporting);

void XLSExport_HeaderRowExporting(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.HeaderRowExportingEventArgs e)

        {

            // unindent child headers for xls export

            if (e.CurrentOutlineLevel > 0)

                e.CurrentColumnIndex = 0;

            FormatHeadersForExport(e.Band, ExportType.Excel);

        }

 

        private void FormatHeadersForExport(UltraGridBand band, ExportType exportType)

        {

            if (band.Index == 0)

            {

                foreach (UltraGridColumn col in band.Columns)

                {

                    switch (col.Key)

                    {

                        case "EstNavPerShare":

                        case "NavPerShare":

                        case "EstimatedEndingBalance":

                        case "EndingBalance":

                            col.Header.Caption = Regex.Replace(col.Header.Caption, "<span.*", "");

                            break;

                    }

                }

            }

        }

 

The headerRowExporting handler fires, and I see the caption being renamed, yet the excel document output doesn't have this change.  Frustrating.  Btw, the same code works for PDF exporter.