private void fpSpread1_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
{
string rowStarLabel = e.Range.Row.ToString();
string rowEndLabel = (e.Range.Row + e.Range.RowCount - 1).ToString();
string colStarLabel = this.fpSpread1.Sheets[0].Columns[e.Range.Column].Label;
string colEndLabel = this.fpSpread1.Sheets[0].Columns[e.Range.Column + e.Range.ColumnCount - 1].Label;
string formula = "SUM(" + colStarLabel + rowStarLabel + ":" + colEndLabel + rowEndLabel + ")";
FarPoint.Win.Spread.SheetView sheetview = new FarPoint.Win.Spread.SheetView();
FarPoint.Win.Spread.CellType.NumberCellType numObj=new FarPoint.Win.Spread.CellType.NumberCellType();
sheetview.Cells[1, 1].CellType = numObj;
sheetview.Cells[1, 1].Formula = formula;
button1.Text = sheetview.Cells[1, 1].Value.ToString();
}
这样做的,但是不行啊,报错!要怎么写才可以呢? |