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
2730
UltraGrid Export
posted

Currently I am exporting the ultragrid thart has two bands. The format of exporting a grid with two bands doesnt look good in excel. Is there a way to only export the first band to one sheet and the second band to another sheet and link them together some how. Because at the moment, if i wanted to do a filter in excel against one column. the filter only works for one parent and child record only.

Below is what i currently have to export the grid

 

 

 

 

this.ultraGridExcelExporter1.Export(this.ultraGrid1, dlg.FileName, Infragistics.Documents.Excel.WorkbookFormat.Excel2007);

Parents
No Data
Reply
  • 48586
    posted

     

    Hello,

     

    I think that the easiest way to export each band in a separate worksheet is to get the underlying data table for the child band to set it as DataSource of grid object and then to export this grid object with the following override of public Infragistics.Documents.Excel.Workbook Export(

       Infragistics.Win.UltraWinGrid.UltraGrid grid,

       Infragistics.Documents.Excel.Worksheet worksheet,

       int startRow,

       int startColumn

    )

    method. You could do this with code similar to:

     

    Workbooc wb = new Workbook();

    Worrksheet sheet1 =  wb.Worksheet.Add(Name)

    ultraGridExcelExporter.Export(ultraGrid1, sheet1,0,0);

    UltraGrid ug = new UltraGRid();

    ug.DataSource = GetChildBand();

    ultraGridExcelExporter.Export(ug, sheet1,0,0);

    wb.Save(filename);

     

    But I was researched and I was not able to find any suitable way to present a hierarchical data of type one to many in excel from two different worksheets.

     

    Please let me know if you have any further questions.

Children