Condividi tramite


XmlMappedRange.Characters Property

Gets a Microsoft.Office.Interop.Excel.Characters object that represents a range of characters within the text of the XmlMappedRange control.

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

Syntax

'Declaration
ReadOnly Property Characters As XmlMappedRange_CharactersType
XmlMappedRange_CharactersType Characters { get; }

Property Value

Type: Microsoft.Office.Tools.Excel.XmlMappedRange_CharactersType
A Microsoft.Office.Interop.Excel.Characters object that represents a range of characters within the text of the XmlMappedRange control.

Remarks

The Characters property is intended to be used with the following parameters.

Parameter

Description

Start

The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.

Length

The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

If you attempt to use Characters without specifying any parameters, Characters will get an XmlMappedRange_CharactersType object that is part of Office development tools in Visual Studio infrastructure and is not intended to be used directly from your code.

You can use the Microsoft.Office.Interop.Excel.Characters object to format characters within a text string.

The Microsoft.Office.Interop.Excel.Characters object is not a collection.

Optional Parameters

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

Examples

The following code example uses the Characters property to apply bold formatting to the first character in the text of an XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

Private Sub FormatCharacters()
    Me.CustomerLastNameCell.Characters(1, 1).Text = "Smith" 
    Me.CustomerLastNameCell.Characters(1, 1).Font.Bold = True 
End Sub
private void FormatCharacters()
{
    this.CustomerLastNameCell.Characters[1, 1].Text = "Smith";
    this.CustomerLastNameCell.Characters[1, 1].Font.Bold = true;
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace