是否可以在列上设置公式首先说“= SUM(A1:A10)”,之后显示A1到A10单元格中的值,然后进行计算。
答案 0 :(得分:1)
是的我得到了答案。在为此做一些R N D时,我意识到Furmula操作无法使用:
SpreadsheetGear.IRange range = WorkBookViewForData.ActiveWorksheet.Cells["A10"];
range.Formula = "=SUM(A1:A9)"
SpreadsheetGear.IRange range1 = WorkBookViewForData.ActiveWorksheet.Cells["A1"];
range1.value = "1"
SpreadsheetGear.IRange range2 = WorkBookViewForData.ActiveWorksheet.Cells["A2"];
range2.value = "2"
SpreadsheetGear.IRange range3 = WorkBookViewForData.ActiveWorksheet.Cells["A3"];
range3.value = "3"
但可以使用
SpreadsheetGear.IRange range = WorkBookViewForData.ActiveWorksheet.Cells["A10"];
range.Formula = "=SUM(A1:A9)"
WorkBookViewForData.ActiveWorksheet.Cells["A1"].Value="1";
WorkBookViewForData.ActiveWorksheet.Cells["A2"].Value="2";
WorkBookViewForData.ActiveWorksheet.Cells["A3"].Value="3";
其中WorkBookViewForData是SpreadsheetGear控件的名称
答案 1 :(得分:0)
尝试使用以下内容:
totalCell.Formula = "=SUM(C6,C11,C16,C21)";
浏览以下链接以获取详细代码:
http://www.spreadsheetgear.com/support/samples/srcview.aspx?file=outline.aspx
希望它有所帮助。