你可以在grouped事件中加入下面的代码,Text就是定义分组行的文本的。
fpSpread1.Grouped += FpSpread1_Grouped;
- private void FpSpread1_Grouped(object sender, EventArgs e)
- {
- if (fpSpread1.ActiveSheet.Models.Data is FarPoint.Win.Spread.Model.GroupDataModel)
- {
- FarPoint.Win.Spread.Model.GroupDataModel gdm = (FarPoint.Win.Spread.Model.GroupDataModel)fpSpread1.ActiveSheet.Models.Data;
- for (int i = 0; i < gdm.RowCount; i++)
- {
- // Determine whether it is group header row or not
- if (gdm.IsGroup(i))
- {
- // Get group
- var g = gdm.GetGroup(i);
-
- g.Text = "我是分组行:"+ i;
- // Get the reference column of the group and the number of rows included in the group
- Console.WriteLine(string.Format("Column index:{0}, Row count:{1}", g.Column, g.Rows.Count));
- }
- }
- }
- }
复制代码
|