다음을 통해 공유


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

속성 값

현재 선택 영역의 일반 텍스트 내용이 들어 있는 문자열입니다.

예외

이 속성을 .로 설정하려고 할 때 발생합니다 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

설명

있을 수 있는 서식에 관계 없이 현재 선택 영역에서 일반 텍스트 콘텐츠를 추출 하려면이 속성을 사용 합니다.

새 줄 바꿈 문자와 단락 나누기는 이 속성과 동일하게 처리됩니다. 현재 선택 영역에 있는 모든 형식의 콘텐츠 나누기는 이 속성을 읽을 때 새 줄로 변환됩니다.

적용 대상