你好,我做了一个简单的 Demo 演示 通过 ColumnFooter 计算第一列的合计:
- public partial class WebForm1 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- //设置第一列数据,用于计算
- this.FpSpread1.Sheets[0].RowCount = 10;
- this.FpSpread1.Sheets[0].Cells[0, 0].Text = "1";
- this.FpSpread1.Sheets[0].Cells[1, 0].Text = "1";
- this.FpSpread1.Sheets[0].Cells[2, 0].Text = "1";
- this.FpSpread1.Sheets[0].Cells[3, 0].Text = "1";
- this.FpSpread1.Sheets[0].Cells[4, 0].Text = "1";
- //定制 ColumnFooter
- this.FpSpread1.ActiveSheetView.GroupFooterVisible = true;
- this.FpSpread1.ActiveSheetView.ColumnFooter.Visible = true;
- this.FpSpread1.ActiveSheetView.ColumnFooter.RowCount = 1;
- //设置 ColumnFooter 第一列公式为 Sum ,用于计算第一列所有单元格加和.
- this.FpSpread1.ActiveSheetView.Columns[0].AggregationType = FarPoint.Web.Spread.Model.AggregationType.Sum;
- }
复制代码 效果图:
png
|