回复 3楼婧友521的帖子
婧友521 你好,
请使用以下代码测试:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- FpSpread1.Sheets[0].ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1;
- this.FpSpread1.ClientAutoCalculation = true;
- this.FpSpread1.Sheets[0].Cells[0, 2].Tag = "单价";
- this.FpSpread1.Sheets[0].Cells[1, 3].Tag = "数量";
- this.FpSpread1.Sheets[0].Cells[2, 3].Tag = "总金额";
- FarPoint.Web.Spread.Cell _unitPrice = this.FpSpread1.Sheets[0].GetCellFromTag(this.FpSpread1.Sheets[0].Cells[0, 0], "单价");
- FarPoint.Web.Spread.Cell _quantity = this.FpSpread1.Sheets[0].GetCellFromTag(this.FpSpread1.Sheets[0].Cells[0, 0], "数量");
- FarPoint.Web.Spread.Cell _toalPrice = this.FpSpread1.Sheets[0].GetCellFromTag(this.FpSpread1.Sheets[0].Cells[0, 0], "总金额");
- this.FpSpread1.Sheets[0].AllowUserFormulas = true;
- string formula = "R" + (_unitPrice.Row.Index + 1).ToString() + "C" + (_unitPrice.Column.Index + 1).ToString() + "*" + "R" + (_quantity.Row.Index + 1).ToString() + "C" + (_quantity.Column.Index + 1).ToString();
- _toalPrice.Formula = formula;
- }
复制代码 |