XmlMappedRange.Text 属性

获取 XmlMappedRange 控件的文本。

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

语法

声明
ReadOnly Property Text As Object
    Get
Object Text { get; }

属性值

类型:System.Object
XmlMappedRange 控件的文本。

示例

下面的代码示例比较包含格式化数字的单元格的 Text 和 Value2 属性有何不同。 此代码示例假定当前工作表包含一个名为 CustomerLastNameCell 的 XmlMappedRange

Private Sub CompareTextAndValue2()
    Me.CustomerAddress1Cell.Value2 = 1198.3
    Me.CustomerAddress1Cell.NumberFormat = "$#,##0"

    ' Displays "1198.3".
    MsgBox("The Value2 value is: " & Me.CustomerAddress1Cell.Value2.ToString())

    ' Displays "$1,198".
    MsgBox("The Text value is: " & Me.CustomerAddress1Cell.Text.ToString())
End Sub
private void CompareTextAndValue2()
{
    this.CustomerAddress1Cell.Value2 = 1198.3;
    this.CustomerAddress1Cell.NumberFormat = "$#,##0";

    // Displays "1198.3".
    MessageBox.Show("The Value2 value is: " + 
        this.CustomerAddress1Cell.Value2.ToString());

    // Displays "$1,198".
    MessageBox.Show("The Text value is: " +
        this.CustomerAddress1Cell.Text.ToString());
}

.NET Framework 安全性

请参见

参考

XmlMappedRange 接口

Microsoft.Office.Tools.Excel 命名空间