你好,要实现 AMOUNT = QTY * UNIT_PRICE 功能,需要给 AMOUNT 所在列设置 PRODUCT 公式,代码如下:- this.FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "QTY";
- this.FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "UNIT_PRICE";
- this.FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "AMOUNT";
- FarPoint.Web.Spread.CurrencyCellType currencyType = new FarPoint.Web.Spread.CurrencyCellType();
- this.FpSpread1.Sheets[0].Columns[1, 2].CellType = currencyType;
- this.FpSpread1.Sheets[0].Cells[0, 0].Text = "2";
- this.FpSpread1.Sheets[0].Cells[1, 0].Text = "3";
- this.FpSpread1.Sheets[0].Cells[2, 0].Text = "4";
- this.FpSpread1.Sheets[0].Cells[0, 1].Text = "2";
- this.FpSpread1.Sheets[0].Cells[1, 1].Text = "3";
- this.FpSpread1.Sheets[0].Cells[2, 1].Text = "4";
- this.FpSpread1.Sheets[0].Columns[2].Formula = "PRODUCT(A1:B1)";
复制代码 下面是效果图:
png
|