Hello,
How can I export grid data (which is in expand/collapse format) to Flat Row/Column without Expand/ collapse?
Thanks
Venkatesh
Hello Venkatesh,
When the export of the grid starts the grid layout gets cloned. During the export this cloned version is used. What you can do, to have grid exported as flat one without groups, is to clear the SortedColumns collection of the cloned layout band. Nice place to do this is in ExportStarted event of UltraGridExcelExporter. You can use code like this:
private void UltraGridExcelExporter1_ExportStarted(object sender, ExportStartedEventArgs e){ e.Layout.Bands[0].SortedColumns.Clear();}
Please check the attached sample project showing this approach and let me know if this is what you are looking for or if I am missing something.
Thank you for your quick reply. This is not what i'm looking...
My grid looks somthing like this
Col1 Col2 Col3 Col4
Col1 Col2 Col3
When export to excel i want it to look like this
Hi Venkatesh,
It seems that you have hierarchical grid and you need to export only the top level band. If this is what you need you may set ViewStyle of the cloned layout to SingleBand like this:
private void UltraGridExcelExporter1_ExportStarted(object sender, ExportStartedEventArgs e){ e.Layout.ViewStyle = Infragistics.Win.UltraWinGrid.ViewStyle.SingleBand;}
Attached is revised version of my sample project which now exports only the top level band.
Please check my sample and let me know if any additional questions arise.
Thank you for your feedback and screenshot provided.From your screenshot is visible that you have several top level rows. Each row may have several child rows, and each child row may have several grandchild rows. What is not clear is how you will put one parent row, with let say two child rows each with let say four grandchild rows in one single row. Can you try to create such table and share it with me so I can look into this and try to find solution for you.
Consider you have this structure:
ParentCol1 ParentCol2 ParentCol3 ChildCol1 ChildCol2 ChildCol3 GrandchildCol1 GrandchildCol2 GrandchildCol3
and also you have this data in your tables:
ParentValue1.1 ParentValue1.2 ParentValue1.3 ChildValue1.1.1.1 ChildValue1.1.1.2 ChildValue1.1.1.3 GrnadchildValue1.1.1.1.1.1 GrnadchildValue1.1.1.1.1.2 GrnadchildValue1.1.1.1.1.3 GrnadchildValue1.1.1.1.2.1 GrnadchildValue1.1.1.1.2.2 GrnadchildValue1.1.1.1.2.3 GrnadchildValue1.1.1.1.3.1 GrnadchildValue1.1.1.1.3.2 GrnadchildValue1.1.1.1.3.3 ChildValue1.1.2.1 ChildValue1.1.2.2 ChildValue1.1.2.3 GrnadchildValue1.1.1.2.1.1 GrnadchildValue1.1.1.2.1.2 GrnadchildValue1.1.1.2.1.3 GrnadchildValue1.1.1.2.2.1 GrnadchildValue1.1.1.2.2.2 GrnadchildValue1.1.1.2.2.3
Can you try to show me how you expect this data to be exported to your Excel workbook.
Looking forward to your reply.
Hi Milko, Thank you for your response
Yes, My grid have 3 bands. Your correct we will have serveral rows in Band 0 and every row in Band 0 will have one or more child rows and all of them will have grandchild rows.
Thank you for your feedback.
Form the structure you posted it seems that your grid has three levels – Band 0, Band 1 and Band 2. From the structure of exported grid it seems that you need to put all the information from these three bands on single row. This rises some additional questions:
If you can post some real data sample, it will be easier to try to give you solution for what you are looking for. So please try to answer above questions as well as try to send some real data so I can look into this.
Hi Milko,
Thank you for your quick reply. I'm sorry i did not give extact requirement of my problem...
Col1 Col2 Col3 Col4 col5 col6 col7 col8
Col2 Col9 Col10 col11 col5 col6 col7 col8
Col1 Col12 Col13 col5 col6 col7 col8
Col1 Col2 Col3 Col4 col9 col10 col11 col12 col13 col5 col6 col7 col8