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