Freigeben über


XmlMappedRange.NoteText Method

Gets or sets the cell note associated with the XmlMappedRange control.

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

Syntax

'Declaration
Function NoteText ( _
    Text As Object, _
    Start As Object, _
    Length As Object _
) As String
string NoteText(
    Object Text,
    Object Start,
    Object Length
)

Parameters

  • Text
    Type: System.Object

    The text to add to the note (up to 255 characters). The text is inserted starting at position Start, replacing Length characters of the existing note. If this argument is omitted, this method returns the current text of the note starting at position Start, for Length characters.

  • Start
    Type: System.Object

    The starting position for the text that is set or returned. If this argument is omitted, this method starts at the first character. To append text to the note, specify a number larger than the number of characters in the existing note.

  • Length
    Type: System.Object

    The number of characters to be set or returned. If this argument is omitted, Microsoft Office Excel sets or returns characters from the starting position to the end of the note (up to 255 characters). If there are more than 255 characters from Start to the end of the note, this method returns only 255 characters.

Return Value

Type: System.String

Remarks

Cell notes have been replaced by range comments. For more information, see the Comment object.

To add a note that contains more than 255 characters, use this method once to specify the first 255 characters, and then use it again to append the remainder of the note (no more than 255 characters at a time).

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the NoteText method to add a note to an XmlMappedRange, and then prompts the user to remove the note by using the ClearNotes method. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

Private Sub SetNote()
    Me.CustomerLastNameCell.NoteText("This cell contains customer " & _
        "last names.")

    If MessageBox.Show("Remove the note?", "Test", MessageBoxButtons.YesNo) = _
        DialogResult.Yes Then 
        Me.CustomerLastNameCell.ClearNotes()
    End If 
End Sub
private void SetNote()
{
    this.CustomerLastNameCell.NoteText("This cell contains customer " +
        "last names.");

    if (MessageBox.Show("Remove the note?", "Test",
        MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        this.CustomerLastNameCell.ClearNotes();
    }
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace