Posted 15 September 2017, 3:26 am EST
How can I show Row total and column total changes when cell value changes?
Below is the code, and attached the snapshot
protected void Page_Load(object sender, EventArgs e)
{
FpSpread1.EnableAjaxCall = true;
FpSpread1.ClientAutoCalculation = true; if (!IsPostBack) { FpSpread1.ActiveSheetView.AddColumns(19, 1); FpSpread1.Sheets[0].ColumnHeader.Cells[0, 19].Text = "Total"; DateTime dt = Convert.ToDateTime("01/27/2017"); for (int i = 5; i <= 18; i++) { FpSpread1.Sheets[0].ColumnHeader.Cells[0, i].Text = dt.AddDays(i - 18).ToString("ddd") + " " + dt.AddDays(i - 18).ToString("MM/dd"); } for (int i = 5; i <= 19; i++) { FpSpread1.Sheets[0].Columns[i].Width = 56; } FpSpread1.Sheets[0].ColumnFooter.Cells[0, 4].Value = "Total: "; int RowCount = Convert.ToInt32(this.FpSpread1.ActiveSheetView.RowCount); FpSpread1.ActiveSheetView.ColumnCount = 20; // Set formula. FpSpread1.Sheets[0].ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1; FpSpread1.Sheets[0].Columns[19].Formula = "SUM(RC5:RC18)"; FpSpread1.Sheets[0].Columns[19].HorizontalAlign = HorizontalAlign.Right; FarPoint.Web.Spread.DateTimeCellType dt2 = new FarPoint.Web.Spread.DateTimeCellType(); System.Globalization.DateTimeFormatInfo dtf = new System.Globalization.DateTimeFormatInfo(); dtf.LongDatePattern = "D"; dtf.ShortDatePattern = "M/d/yyyy"; dt2.DateTimeFormat = dtf; FpSpread2.Sheets[0].Cells[0, 0, 0, 2].CellType = dt2; FpSpread2.ActiveSheetView.Cells[0, 0].Value = DateTime.Now; FarPoint.Web.Spread.FilterBarCellType fbcell = new FarPoint.Web.Spread.FilterBarCellType(true); fbcell.DatePickerMode = FarPoint.Web.Spread.DatePickerMode.Auto; FpSpread2.Sheets[0].RowCount = 6; FpSpread2.Sheets[0].ColumnCount = 6; //Customize "Cells" in Filter Bar FarPoint.Web.Spread.SheetView sheetView = FpSpread2.ActiveSheetView; sheetView.AutoFilterMode = FarPoint.Web.Spread.AutoFilterMode.FilterBar; sheetView.FilterBar.Cells[0].CellType = fbcell; sheetView.FilterBar.Cells[0].BackColor = System.Drawing.Color.Aqua; } } protected void FpSpread1_CellClick(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e) { int RowCount = Convert.ToInt32(this.FpSpread1.ActiveSheetView.RowCount); FpSpread1.ActiveSheetView.ColumnCount = 20; // Set formula. FpSpread1.Sheets[0].ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1; FpSpread1.Sheets[0].Columns[19].Formula = "SUM(RC5:RC18)"; FpSpread1.Sheets[0].Columns[19].HorizontalAlign = HorizontalAlign.Right; }