斑竹,实在是不好意思,按着你的意识,我还是没有实现我想要的结果,能不能麻烦你帮我写下代码,
private void CreateGroupFooter(int colindex)
{
// 添加默认分组列
SheetView sheet = fpSpread1.ActiveSheet;
sheet.AllowGroup = true;
GroupDataModel gdm = new GroupDataModel(sheet.Models.Data);
sheet.Models.Data = gdm;
//SortInfo 构造函数 SortInfo(0, true) 中第一个参数为 用于分组的列索引。
SortInfo[] siList = new SortInfo[] { new SortInfo(colindex, true) };
gdm.Group(siList, null);
//设置默认分组
DefaultGroupFooter dgf = fpSpread1_Sheet1.DefaultGroupFooter[colindex];
ISheetDataModel dataModel = dgf.DataModel;
// 设置分组中的公式汉字显示get(5)
FarPoint.Win.Spread.CellType.TextCellType a = new TextCellType();
this.fpSpread1_Sheet1.Columns.Get(5).CellType = a;
//设置分组脚中公式
//(dataModel as IAggregationSupport).SetCellAggregationType(0, 0, AggregationType.Count);
// (dataModel as IAggregationSupport).SetCellAggregationFormat(0, 0, "数量:{0}");
(dataModel as IAggregationSupport).SetCellAggregationType(0, 5, AggregationType.Sum);
(dataModel as IAggregationSupport).SetCellAggregationFormat(0, 5, "合计:{0}");
fpSpread1_Sheet1.GroupFooterVisible = true;
}
就是在这个里面怎么把合计的那一行和分组标题放在同一行,谢谢 |