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
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.
How to get access to GetChildBand();
What class or library this functions is in?
This is what i have below i havent tried it yet.
Infragistics.Documents.Excel.
();
wb.Worksheets.Add(dlg.FileName);
ultraGridExcelExporter1.Export(ultraGrid1, sheet1,0,0);
ug.DataSource =
GetChildBand(); // THis line is giving me an error. dont know what getchild band is
wb.Save(dlg.FileName);
Hello ,
I have created a small sample in order to illustrate my idea. Please run the sample and press “Export” button. Please let me know if this is what you are looking for.
Ok this works.
And it exports the each band seperately like I wanted. But now it exports all the rows instead of the rows I have hidden on the grid. Which what I dont want.
When I try to call the table directly I get a error.
Child list for field table cannot be created.
How to get the table with only the columns I ask for without getting the error
"Child list for field table cannot be created.".
the logic I use is below.
this.ultrgrid.datasouce = this.dataset.table; // i get the error on this line
Worksheet
sheet2 = wb.Worksheets.Add("Table1");
ultraGridExcelExporter1.Export(ultraGrid, sheet2, 0, 0);
Hello,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.