回复 6楼婧友521的帖子
建议通过拼接公式的方法实现:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- this.FpSpread1.ColumnFooter.Visible = true;
- string startLable = this.FpSpread1.Sheets[0].Rows[0].Label;
- string endLable = this.FpSpread1.Sheets[0].Rows[this.FpSpread1.Sheets[0].RowCount - 1].Label;
- StringBuilder sb = new StringBuilder();
- sb.Append("SUM(");
- sb.Append("A" + startLable);
- sb.Append(":");
- sb.Append("A" + endLable + ")");
-
- this.FpSpread1.Sheets[0].RowCount += 1;
- this.FpSpread1.Sheets[0].Cells[this.FpSpread1.Sheets[0].RowCount - 1, 0].Formula = sb.ToString();
- }
复制代码 |