fpSpread1.Sheets[0].RowCount = 8;
fpSpread1.Sheets[0].ColumnCount = 15;
fpSpread1.Sheets[0].GroupBarInfo.Visible = true;
fpSpread1.Sheets[0].AllowGroup = true;
fpSpread1.Sheets[0].GroupFooterVisible = true;
fpSpread1.Sheets[0].ColumnFooter.Visible = true;
fpSpread1.Sheets[0].ColumnFooter.RowCount = 2;
fpSpread1.Sheets[0].ColumnFooter.Columns[12].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
fpSpread1.Sheets[0].ColumnFooter.Cells[0, 12].RowSpan = 2;
//Value
for (int r = 0; r < fpSpread1.Sheets[0].RowCount; r++)
{
for (int j = 0; j < fpSpread1.Sheets[0].ColumnCount; j++)
{
fpSpread1.Sheets[0].Models.Data.SetValue(r, j, j + r * fpSpread1.Sheets[0].ColumnCount);
}
}
fpSpread1.Sheets[0].ColumnFooter.Cells[0, 1].Formula = "\"Sum: \" & SUM(Sheet1!B:B)";
fpSpread1.Sheets[0].Models.ColumnFooterRowAxis.SetResizable(1, true);
fpSpread1.Sheets[0].ColumnFooter.Cells[0, 0].Value = "Sum";
}
private void fpSpread1_Grouped(object sender, EventArgs e)
{
FarPoint.Win.Spread.Model.GroupDataModel gdm;
gdm = (FarPoint.Win.Spread.Model.GroupDataModel)fpSpread1.ActiveSheet.Models.Data;
gdm.GroupFooterVisible = true;
FarPoint.Win.Spread.Model.Group g1 = (FarPoint.Win.Spread.Model.Group)gdm.Groups[1];
((FarPoint.Win.Spread.Model.IAggregationSupport)g1.GroupFooter.DataModel).SetCellAggregationType(0, 0, FarPoint.Win.Spread.Model.AggregationType.Sum);
((FarPoint.Win.Spread.Model.IAggregationSupport)g1.GroupFooter.DataModel).SetCellAggregationFormat(0, 0, "Sum: {0}");
fpSpread1.ActiveSheet.Models.Data = gdm;
}
FpSpread1.Sheets(0).RowCount = 8
FpSpread1.Sheets(0).ColumnCount = 15
FpSpread1.Sheets(0).GroupBarInfo.Visible = True
FpSpread1.Sheets(0).AllowGroup = True
FpSpread1.Sheets(0).GroupFooterVisible = True
FpSpread1.Sheets(0).ColumnFooter.Visible = True
FpSpread1.Sheets(0).ColumnFooter.RowCount = 2
FpSpread1.Sheets(0).ColumnFooter.Columns(12).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left
FpSpread1.Sheets(0).ColumnFooter.Cells(0, 12).RowSpan = 2
'Value
For r As Integer = 0 To FpSpread1.Sheets(0).RowCount - 1
For j As Integer = 0 To FpSpread1.Sheets(0).ColumnCount - 1
FpSpread1.Sheets(0).Models.Data.SetValue(r, j, j + r * FpSpread1.Sheets(0).ColumnCount)
Next
Next
FpSpread1.Sheets(0).ColumnFooter.Cells(0, 1).Formula = """Sum: "" & SUM(Sheet1!B:B)"
FpSpread1.Sheets(0).Models.ColumnFooterRowAxis.SetResizable(1, True)
FpSpread1.Sheets(0).ColumnFooter.Cells(0, 0).Value = "Sum"
End Sub
Private Sub FpSpread1_Grouped(ByVal sender As Object, ByVal e As EventArgs)
Dim gdm As FarPoint.Win.Spread.Model.GroupDataModel
gdm = CType(FpSpread1.ActiveSheet.Models.Data, FarPoint.Win.Spread.Model.GroupDataModel)
gdm.GroupFooterVisible = True
Dim g1 As FarPoint.Win.Spread.Model.Group = CType(gdm.Groups(1), FarPoint.Win.Spread.Model.Group)
(CType(g1.GroupFooter.DataModel, FarPoint.Win.Spread.Model.IAggregationSupport)).SetCellAggregationType(0, 0, FarPoint.Win.Spread.Model.AggregationType.Sum)
(CType(g1.GroupFooter.DataModel, FarPoint.Win.Spread.Model.IAggregationSupport)).SetCellAggregationFormat(0, 0, "Sum: {0}")
FpSpread1.ActiveSheet.Models.Data = gdm
End Sub
End Class