如何使用SpreadsheetLight正确分组Excel中的行?

我目前正在使用SpreadsheetLight将一些数据导出到Excel,但是我从来没有把它们分组。 所以现在我需要你的帮助。
我有以下代码:

if (groupingProperties.Any()) { int start = data.Rows.Count + 2; GroupRows<T, TId>(slDocument, data.AsEnumerable().Reverse(), ref start, 0, groupingProperties); } 

其中slDocument是SpreadsheetLight的SLDocument的实例, data是通过groupingProperties正确sorting的DataTableGroupRows方法:

 private static void GroupRows<T, TId>(SLDocument slDocument, IEnumerable<DataRow> rowCollection, ref int start, int level, params string[] groupingProperties) where T : AbstractEntity<T, TId> { foreach ( var grouped in from row in rowCollection group row by row[groupingProperties[level]].ToString() into g select g) { slDocument.InsertRow(start, 1); slDocument.MergeWorksheetCells(start, 1, start, AbstractEntity<T, TId>.SearchDictionary.Values.Count( _ => !String.IsNullOrEmpty(_))); slDocument.SetCellStyle(start, 1, new SLStyle {Font = new SLFont {Bold = true, Italic = true}}); slDocument.SetCellValue(start, 1, String.Format("{0}{1}: {2} (total {3})", new string(' ', level*4), AbstractEntity<T, TId>.SearchDictionary.Single( _ => _.Key == groupingProperties[level]).Value, grouped.Key, grouped.Count())); if (level == groupingProperties.Count() - 1) { start -= grouped.Count(); } else { GroupRows<T, TId>(slDocument, grouped.ToList(), ref start, level + 1, groupingProperties); } } } 

之后,此代码会为每个分组条件生成具有缩进的优秀电子表格,但不会实际进行分组。 我试图使用SpreadsheetLight的GroupRows方法(一些鼓舞人心的时刻可以采取在这里 )卡住了。
任何有关这个问题的帮助将不胜感激。