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
1775
Exporting hierarchical header to Excel
posted

 

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?

 

 

Parents
No Data
Reply
  • 138253
    Offline posted

    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.

Children