回复 15楼lvxiangjun1的帖子
测试代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- return;
- //允许客户端自动控制表单大小
- this.FpSpread1.ClientAutoSize = true;
- //允许使用公式
- this.FpSpread1.Sheets[0].AllowUserFormulas = true;
- //允许客户端自动计算
- this.FpSpread1.ClientAutoCalculation = true;
- //设置每页行数
- this.FpSpread1.Sheets[0].RowCount = 20;
- this.FpSpread1.Sheets[0].PageSize = 20;
- int rowCount = this.FpSpread1.Sheets[0].RowCount;
- int columnCount = this.FpSpread1.Sheets[0].ColumnCount;
- for (int i = 0; i < columnCount; i++)
- {
- string columnLabel = this.FpSpread1.Sheets[0].ColumnHeader.Columns[i].Label;
- string formula = "SUM(" + columnLabel + "6" + ":" + columnLabel + "15)";
- this.FpSpread1.Sheets[0].Cells[rowCount - 1, i].Formula = formula;
- }
- }
复制代码 |