TextRange.Text 속성

정의

현재 선택 영역의 일반 텍스트 콘텐츠를 가져오거나 설정합니다.

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

속성 값

String

현재 선택 영역의 일반 텍스트 콘텐츠가 들어 있는 문자열입니다.

예외

이 속성을 null로 설정하려고 하는 경우

예제

다음 예제에서는 사용 된 Text 속성입니다.

// 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

설명

이 속성을 사용 하 여 있을 수 있는 모든 형식에 관계 없이 현재 선택 영역의 일반 텍스트 콘텐츠를 추출 하도록 합니다.

줄 바꿈 문자 및 단락 나누기가이 속성에 대해 동일한 것으로 처리 됩니다. 현재 선택 영역에 있는 콘텐츠 구분선의 모든 형식은이 속성을 읽을 때 새 줄으로 변환 됩니다.

적용 대상