TextRange.Text Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u de tekst zonder opmaak van de huidige selectie op of stelt u deze in.
public:
property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
public string Text { get; set; }
member this.Text : string with get, set
Public Property Text As String
Waarde van eigenschap
Een tekenreeks met de tekst zonder opmaak van de huidige selectie.
Uitzonderingen
Treedt op wanneer er een poging wordt gedaan om deze eigenschap in te stellen op null.
Voorbeelden
In het volgende voorbeeld ziet u het gebruik van de Text eigenschap.
// This method returns a plain text representation of a specified FlowDocument.
string GetTextFromFlowDocument(FlowDocument flowDoc)
{
// Create a new TextRanage that takes the entire FlowDocument as the current selection.
TextRange flowDocSelection = new TextRange(flowDoc.ContentStart, flowDoc.ContentEnd);
// Use the Text property to extract a string that contains the unformatted text contents
// of the FlowDocument.
return flowDocSelection.Text;
}
' This method returns a plain text representation of a specified FlowDocument.
Private Function GetTextFromFlowDocument(ByVal flowDoc As FlowDocument) As String
' Create a new TextRanage that takes the entire FlowDocument as the current selection.
Dim flowDocSelection As New TextRange(flowDoc.ContentStart, flowDoc.ContentEnd)
' Use the Text property to extract a string that contains the unformatted text contents
' of the FlowDocument.
Return flowDocSelection.Text
End Function
Opmerkingen
Gebruik deze eigenschap om de inhoud zonder opmaak in de huidige selectie te extraheren, ongeacht de opmaak die aanwezig is.
Nieuwe regeltekens en alinea-einden worden behandeld als gelijkwaardig met betrekking tot deze eigenschap. Alle typen inhoudseinden die aanwezig zijn in de huidige selectie, worden geconverteerd naar nieuwe regels wanneer deze eigenschap wordt gelezen.