Hello everyone,
I have a XamGrid in that state.
And here is my problem : when i export the XamGrid with the export function from the samples everything is fine, but when i apply more than one group i have only the fisrt group expandable in the Excel file.
As we can see we can collapse/expand the first group by the second is just indent.
Is someone knows how can I do to collapse the next groups ?
HI,
I am reviewing your issue
Sincerely, Matt Developer Support Engineer
The OutlineLevel controls the grouping of the rows in the Excel. The following code shows how this property is used.
Workbook wb = new Workbook(); Worksheet ws = wb.Worksheets.Add("MySheet"); ws.Rows[0].OutlineLevel = 1; ws.Rows[0].Cells[0].Value = "Level 1"; ws.Rows[1].OutlineLevel = 2; ws.Rows[1].Cells[1].Value = "Level 2"; ws.Rows[2].OutlineLevel = 3; ws.Rows[2].Cells[2].Value = "Level 3"; ws.Rows[3].OutlineLevel = 3; ws.Rows[3].Cells[2].Value = "Level 3 Row 2"; ws.Rows[4].OutlineLevel = 1; ws.Rows[4].Cells[0].Value = "Level 1 - Row 2"; ws.Rows[5].OutlineLevel = 2; ws.Rows[5].Cells[1].Value = "Level 2 - Row 1 of Row 2"; ws.Rows[6].OutlineLevel = 3; ws.Rows[6].Cells[2].Value = "Level 3"; ws.Rows[7].OutlineLevel = 3; ws.Rows[7].Cells[2].Value = "Level 3 Row 2"; SaveFileDialog sd = new SaveFileDialog(); if (sd.ShowDialog() == true) { Stream s = sd.OpenFile(); wb.Save(s); s.Dispose(); }
I really think it's an algorithmic problem, when i passed throught the function in debug mode the outilne level increments with no reasons. I pretty sure the problem come from the récursive call but i can't see it if someone could look that way and tell me if it's really impossible or else.
Thanks
HI Cosoluce,
I noticed that you are increasing the OutlineLevel every time you encounter a child GroupByRow. What happens if you move the OutlineLevel increment to somewhere outside the foreach loop for the GroupByRowChildren?"
Sinc erely, Matt Developer Support Engineer
Thanks for your reply i reviewed the code and finally found the soution. The problem was on the recursive call, i increased the outlinelevel instead of passe the outlinelevel value plus one.
To solve the problem i replaced the parameters in the recursive call :
IterateGroupByRow(child as GroupByRow, outlinelevel+1);
And that's it!
Thanks to everybody for the replies.
Regards
Stones:
Can you share the export to excel complete code
I do have a similar need, xamgrid has 2 grouped columns ,and user clicks Export need the excel in the same format they see on screen, right now i get row data in excel without groupings.
thanks
Hello,
I made you a solution, let me know if you have further questions.