请参考以下代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- FpSpread1.Sheets[0].RowCount = 8;
- FpSpread1.Sheets[0].ColumnCount = 15;
- this.FpSpread1.ActiveSheetView.GroupBarVisible = true;
- this.FpSpread1.ActiveSheetView.AllowGroup = true;
- this.FpSpread1.ActiveSheetView.GroupFooterVisible = true;
- this.FpSpread1.ActiveSheetView.ColumnFooter.Visible = true;
- this.FpSpread1.ActiveSheetView.ColumnFooter.RowCount = 2;
- this.FpSpread1.ActiveSheetView.ColumnFooter.DefaultStyle.Border.BorderStyle = BorderStyle.Double;
- this.FpSpread1.ActiveSheetView.ColumnFooter.Columns[12].HorizontalAlign = HorizontalAlign.Left;
- this.FpSpread1.ActiveSheetView.ColumnFooter.Cells[0, 12].RowSpan = 2;
- //Value
- Random rdm = new Random();
- for (int r = 0; r < this.FpSpread1.ActiveSheetView.RowCount; r++)
- {
- for (int j = 0; j < this.FpSpread1.ActiveSheetView.ColumnCount; j++)
- FpSpread1.ActiveSheetView.Cells[r, j].Value = rdm.Next(10, 50);
- }
- int i = 0;
- this.FpSpread1.ActiveSheetView.Columns[i].AggregationType = FarPoint.Web.Spread.Model.AggregationType.Sum;
- this.FpSpread1.ActiveSheetView.ColumnFooter.Cells[0, i].Value = "Sum";
- this.FpSpread1.ActiveSheetView.ColumnFooter.Cells[1, i].Value = "合计:[{0}]";
- }
复制代码 |