WorksheetBase.ConsolidationFunction 属性

获取用于当前合并的函数代码。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel.v4.0.Utilities(在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

语法

声明
Public ReadOnly Property ConsolidationFunction As XlConsolidationFunction
public XlConsolidationFunction ConsolidationFunction { get; }

属性值

类型:Microsoft.Office.Interop.Excel.XlConsolidationFunction
XlConsolidationFunction 值之一。

示例

下面的代码示例使用 ConsolidationFunction 属性确定该工作表使用哪个函数来进行合并。

此示例针对的是文档级自定义项。

Private Sub ShowConsolidationFunction()
    Dim simpleName As String

    Select Case Me.ConsolidationFunction
        Case Excel.XlConsolidationFunction.xlSum
            simpleName = "Sum()"
        Case Excel.XlConsolidationFunction.xlMax
            simpleName = "Max()"
        Case Excel.XlConsolidationFunction.xlProduct
            simpleName = "Product()"
        Case Else
            simpleName = "Other"
    End Select
    MsgBox("This worksheet uses " & simpleName & _
        " for the consolidation function.")
End Sub
private void ShowConsolidationFunction()
{
    string simpleName;

    switch (this.ConsolidationFunction)
    {
        case Excel.XlConsolidationFunction.xlSum:
            simpleName = "Sum()";
            break;

        case Excel.XlConsolidationFunction.xlMax:
            simpleName = "Max()";
            break;

        case Excel.XlConsolidationFunction.xlProduct:
            simpleName = "Product()";
            break;

        default:
            simpleName = "Other";
            break;
    }
    MessageBox.Show("This worksheet uses " + simpleName +
        " for the consolidation function.");
}

.NET Framework 安全性

请参见

参考

WorksheetBase 类

Microsoft.Office.Tools.Excel 命名空间