回复 9楼alofa的帖子
调查结果如下:
1.如果通过cell[0,0,1,3]这种方式设置,只有 Cell[0,0] 启作用,需要逐个单元格遍历设置。
2.公式单元格不起作用的原因是单元格类型引起的,请设置需要设置margin的单元格类型为doublecelltype。
测试代码:
- FarPoint.Web.Spread.DoubleCellType db = new FarPoint.Web.Spread.DoubleCellType();
- for (int i = 0; i < this.FpSpread1.Sheets[0].Rows.Count-1; i++)
- {
- for (int j = 0; j < this.FpSpread1.Sheets[0].Columns.Count; j++)
- {
- this.FpSpread1.Sheets[0].Cells[i, j].CellType = db;
- this.FpSpread1.Sheets[0].Cells[i, j].Value = 12;
- this.FpSpread1.Sheets[0].Cells[i, j].Margin.Right = 12;
- }
- }
- this.FpSpread1.Sheets[0].Rows[2].Formula = "SUM(A1:A2)";
- this.FpSpread1.Sheets[0].Rows[2].CellType = db ;
- this.FpSpread1.Sheets[0].Cells[2, 0].Margin.Right = 12;
- this.FpSpread1.Sheets[0].Cells[2, 1].Margin.Right = 12;
- this.FpSpread1.Sheets[0].Cells[2, 2].Margin.Right = 12;
复制代码 |