Recently a customer enquired about an implementation in Spread for Winforms control wherein he wanted to set custom formula for Column Footer Aggregation. Spread's SetAggregationType() method sets the formula for the cell of a specified row and column in the column footer wherein we can set custom AggregationType enumeration. Here in this blog, we will discuss a small implementation of setting custom formula for column footer aggregation using SetAggregationType() method and setting custom formula in the same cell. For example, this custom formula in Column Footer sum only those cells of the column whose value is greater than 10. Following code block shows the implementation:-
fpSpread1_Sheet1.Rows.Count = 10;
fpSpread1_Sheet1.Columns.Count = 5;
fpSpread1.ActiveSheet.ColumnFooter.Visible = true;
fpSpread1.ActiveSheet.ColumnFooter.SetAggregationType(0, 0, AggregationType.Custom);
fpSpread1.ActiveSheet.ColumnFooter.Cells[0, 0].Formula = "SUMIF(Sheet1!A:A,\\">10\\")";
Custom Column Footer Aggregation Refer to the attached sample for complete implementation. DownloadSample_CS DownloadSample_VB