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
90
Hierarchical Excel Export
posted

I am exporting a hierarchical data source to excel using the excel exporter with multiple bands.  The bands are indented in Excel when exported.  For example, band 1 starts at column A, band 2's first column is in column B.  Is there any way to make all the bands start in column A?

Parents
No Data
Reply
  • 2501
    Suggested Answer
    posted

    Hello,

    To prevent the Child Band Indentation when exporting a Hierarchical WebGrid to EXCEL, check for the Child Band Key in the UltraWebGridExcelExporter HeaderRowExporting and RowExporting events and set the CurrentColumnIndex to 0.

    The following code example demonstrates how:

    protected void UltraWebGridExcelExporter1_HeaderRowExporting(object sender,
           Infragistics.WebUI.UltraWebGrid.ExcelExport.
    HeaderRowExportingEventArgs e)
    {
           // Check for the Child Band Key from the Band
           // to set CurrentColumnIndex Indentation to 0
           if (e.Band.Key == "[Child Band Key]")
           {
                 e.CurrentColumnIndex = 0;
           }
    }

    protected void UltraWebGridExcelExporter1_RowExporting(object sender,
          Infragistics.WebUI.UltraWebGrid.ExcelExport.
    RowExportingEventArgs e)
    {
          // Check for the Child Band Key from the GridRow
          // to set CurrentColumnIndex Indentation to 0
          if (e.GridRow.Band.Key == "[Child Band Key]")
          {
                e.CurrentColumnIndex = 0;
          }
    }

    Please let me know if this helps or if you have any questions.

    Sincerely,
    Mike D.
    Developer Support Engineer
    Infragistics, Inc.

Children
No Data