Text Property
TOC
Collapse the table of content
Expand the table of content

NamedRange.Text Property

 

Gets the text for the NamedRange control.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

object Text { get; }

Property Value

Type: System.Object

The text for the NamedRange control.

Returns null for NamedRange controls with multiple cells.

The following code example compares how the Text and Value2 properties differ for cells that contain formatted numbers.

This example is for a document-level customization.

private void DisplayText()
{
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1"],
        "namedRange1");
    namedRange1.Value2 = 223;

    namedRange1.Value2 = 1198.3;
    namedRange1.NumberFormat = "$#,##0";

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

    // Displays "$1,198".
    MessageBox.Show("The Text value is: " +
        namedRange1.Text.ToString());
}
Return to top
Show:
© 2016 Microsoft