Hello,
We are exporting data from xamGrid to Excel. We have 2 examples of hierarchical header.
1. TextColumn col1 = new TextColumn() {Key = "Col1", HeaderText = "Col1" }; TextColumn col2 = new TextColumn() { Key = "Col2", HeaderText = "Col2" }; TextColumn col3 = new TextColumn() { Key = "Col3", HeaderText = "Col3" }; TextColumn col4 = new TextColumn() { Key = "Col4", HeaderText = "Col4" }; TextColumn col9 = new TextColumn() { Key = "Col9", HeaderText = "Col9" }; GroupColumn col5 = new GroupColumn() { Key = "Col5", HeaderText = "Col5" }; GroupColumn col6 = new GroupColumn() { Key = "Col6", HeaderText = "Col6" }; GroupColumn col7 = new GroupColumn() { Key = "Col7", HeaderText = "Col7" }; GroupColumn col8 = new GroupColumn() { Key = "Col8", HeaderText = "Col8" }; GroupColumn col10 = new GroupColumn() { Key = "Col10", HeaderText = "Col10" }; GroupColumn col11 = new GroupColumn() { Key = "Col11", HeaderText = "Col11" }; col8.Columns.Add(col5); col5.Columns.Add(col6); col6.Columns.Add(col4); col7.Columns.Add(col1); col7.Columns.Add(col2); col7.Columns.Add(col3); col11.Columns.Add(col10); col10.Columns.Add(col9); xamGrid1.Columns.Add(col11); xamGrid1.Columns.Add(col7); xamGrid1.Columns.Add(col4);
In application it looks like.
First column looks very strange and it can't be realized in Excel, because cells of 2nd column are presented in 2 different rows.
2. We tried another example
TextColumn col1 = new TextColumn() {Key = "Col1", HeaderText = "Col1" }; TextColumn col2 = new TextColumn() { Key = "Col2", HeaderText = "Col2" }; TextColumn col3 = new TextColumn() { Key = "Col3", HeaderText = "Col3" }; TextColumn col4 = new TextColumn() { Key = "Col4", HeaderText = "Col4" }; TextColumn col9 = new TextColumn() { Key = "Col9", HeaderText = "Col9" }; GroupColumn col5 = new GroupColumn() { Key = "Col5", HeaderText = "Col5" }; GroupColumn col6 = new GroupColumn() { Key = "Col6", HeaderText = "Col6" }; GroupColumn col7 = new GroupColumn() { Key = "Col7", HeaderText = "Col7" }; GroupColumn col8 = new GroupColumn() { Key = "Col8", HeaderText = "Col8" }; GroupColumn col10 = new GroupColumn() { Key = "Col10", HeaderText = "Col10" }; GroupColumn col11 = new GroupColumn() { Key = "Col11", HeaderText = "Col11" }; col8.Columns.Add(col5); col5.Columns.Add(col6); col6.Columns.Add(col4); col7.Columns.Add(col1); col7.Columns.Add(col2); col7.Columns.Add(col3); col11.Columns.Add(col10); col10.Columns.Add(col9); xamGrid1.Columns.Add(col8); xamGrid1.Columns.Add(col11); xamGrid1.Columns.Add(col7);
The result.
Is there any algorithm, why cells are merged in this way? Can it be changed from code? I think that cells of last level (col4, col9, col1, col2 and col3) should be merged if there isn't enough cells in that column. Or is there any way to undestand how cells in header are merged to export it to Excel?
Hello.
I asked about exporting header, not rows. We have written own algorithm of exporting such headers. But still want to know why rows in header are merging in that way)
Hello Sergey,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I believe Darrell and Stephen already answer to your question here:
http://forums.infragistics.com/forums/p/61540/312090.aspx#312090
Feel free to write me if you have further questions.