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
525
How to Export data in to Excel in Hierarchical manner
posted

Hi ,

I am using Infragistics v8.2, my problem is when i am trying to Export ultrawebgrid to excel only my first Band data is exporting but under my grid i had three bands.

Ex:

Hospital               IsActive                 Curentstatus   -----      First Band

+Hospital1              true                       valid

    Doctor              Speciality         IsActive  -----------------------Second Band            

   + John                  cardiology          true

         Patientname      Age     Sex---------------------------------------Third Band

         Patient1               30         M

         Patient2               35         F 

   + Shaym               Ortho                false

        Patientname      Age     Sex

        Patient3               25          F

        Patient4               27          M

+Hospital2              false                      Invalid

   Doctor              Speciality         IsActive

   + David                  cardiology          true

         Patientname      Age     Sex

         Patient5              30         M

         Patient6               35         F 

   + Lee               Ortho                false

        Patientname      Age     Sex

        Patient7               25          F

        Patient8               27          M

 

When grid will load only first band(Hospitals) will come with (+) Mark, when user will expand this Doctors(Second band) and when user will expand this Patients(Third band) will come. like in above manner.

But the Problem when i am trying to Export this Ultrawebgrid to Excel i am getting only my first Band (Hospitals) i am not getting remaining bands(Doctors,Patients).

Export Events:

protected void Ultraexcelexporter_CellExporting(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.CellExportingEventArgs e)

{

if (e.Value != null)

{

Infragistics.Excel.
IWorksheetCellFormat cfCellFmt;

int iRdex = e.CurrentRowIndex;

int iCdex = e.CurrentColumnIndex;

// Obtain reference to CellFormat object for current cell.

cfCellFmt = e.CurrentWorksheet.Rows[iRdex].Cells[iCdex].CellFormat;

// Set format property for the font color to red.

cfCellFmt.Font.Color = System.Drawing.Color.Red;

// Apply the formatting, this step minimizes the number of

// Worksheet Font objects that need to be instantiated.

//e.CurrentWorksheet.DisplayOptions.OrderColumnsRightToLef;

}

}

protected void Ultraexcelexporter_SummaryCellExporting(object sender, Infragistics.WebUI.UltraWebGrid.ExcelExport.SummaryCellExportingEventArgs e)

{

if ((e.CurrentWorksheet != null))

{

Infragistics.Excel.
Worksheet WFmt = e.CurrentWorksheet;WFmt.Workbook.Precision = Infragistics.Excel.Precision.UseRealCellValues;

}

}

protected void btnallexpexcel_Click(object sender, EventArgs e)

{

Ultraexcelexporter.DownloadName = "Sample.xls";
Ultraexcelexporter.WorksheetName = ddlFromMonth.SelectedItem.Text + " " + ddlFromYear.SelectedItem.Text;

Ultraexcelexporter.Export(Ultraall).Precision = 0.00;

}

 

Design declarions  :

<igtblexp:UltraWebGridExcelExporter ID="Ultraexcelexporter" runat="server"

OnSummaryCellExporting="Ultraexcelexporter_SummaryCellExporting" OnSummaryCellExported="Ultraexcelexporter_SummaryCellExported"

OnCellExporting="Ultraexcelexporter_CellExporting" TypeCoercion="Default"

ExportMode="Download">

</igtblexp:UltraWebGridExcelExporter>

 

Please help me ...... 

Thanks, regards

Sivaprasad

   

Parents
No Data
Reply
  • 45049
    posted

    If you have hierarchical data in WebGrid that you export to Excel, then it should export that hierarchical data to the Excel worksheet.

    There is one setting I can think about that might affect this.  If you're using Automatic, Manual, or Xml for your DisplayLayout.LoadOnDemand setting on your grid, set it to None and call DataBind() on the grid just before calling Export() on the WebGridExcelExporter.  This is because all of these settings will restrict what rows of data are actually added as rows to WebGrid, and the Excel exporter will only export the rows that exist in the grid.

    If you already have LoadOnDemand set to None and are seeing this problem, then it's something I'm not familiar with.  In this situation, please submit a support request so that a Developer Support Engineer can investigate further.  It would be helpful if you can include a small sample project that we can run and debug and which demonstrates this behavior, so that we know we're running the same code you're running.

Children