Share via


PlainTextContentControl 인터페이스

문서의 텍스트 블록을 나타냅니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word(Microsoft.Office.Tools.Word.dll)

구문

‘선언
<GuidAttribute("a8c46931-fa10-4760-8b46-0f2d881e269f")> _
Public Interface PlainTextContentControl _
    Inherits ContentControlBase, IBindableComponent, IComponent, IDisposable,  _
    ISupportInitialize
[GuidAttribute("a8c46931-fa10-4760-8b46-0f2d881e269f")]
public interface PlainTextContentControl : ContentControlBase, 
    IBindableComponent, IComponent, IDisposable, ISupportInitialize

PlainTextContentControl 형식에서는 다음과 같은 멤버를 노출합니다.

속성

  이름 설명
Public 속성 Application Microsoft Office Word의 현재 인스턴스를 나타내는 Microsoft.Office.Interop.Word.Application을 가져옵니다.
Public 속성 BindingContext IBindableComponent 에 대한 현재 위치 관리자의 컬렉션을 가져오거나 설정합니다. (IBindableComponent에서 상속됨)
Public 속성 Container 인프라입니다. (ContentControlBase에서 상속됨)
Public 속성 ContainerComponent 인프라입니다. (ContentControlBase에서 상속됨)
Public 속성 Creator PlainTextContentControl 이 만들어진 응용 프로그램을 나타내는 32비트 정수를 가져옵니다.
Public 속성 DataBindings IBindableComponent에 대한 데이터 바인딩 개체의 컬렉션을 가져옵니다. (IBindableComponent에서 상속됨)
Public 속성 DefaultDataSourceUpdateMode ContentControlBase 에 대한 기본 DataSourceUpdateMode를 가져오거나 설정합니다. (ContentControlBase에서 상속됨)
Public 속성 DefaultTextStyle PlainTextContentControl 의 텍스트 형식을 지정하는 데 사용할 문자 스타일 이름을 가져옵니다.
Public 속성 ID 콘텐츠 컨트롤을 식별하는 고유 번호를 가져옵니다. (ContentControlBase에서 상속됨)
Public 속성 InnerObject Microsoft.Office.Tools.Word.ContentControlBase 에 대한 내부 Microsoft.Office.Interop.Word.ContentControl 개체를 가져옵니다. (ContentControlBase에서 상속됨)
Public 속성 LockContentControl 문서에서 PlainTextContentControl을 삭제할 수 있는지 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성 LockContents PlainTextContentControl 의 내용을 편집할 수 있는지 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성 MultiLine PlainTextContentControl 에 줄 바꿈을 포함할 수 있는지 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성 Parent PlainTextContentControl 의 부모를 가져옵니다.
Public 속성 ParentContentControl 다른 콘텐츠 컨트롤에 중첩된 PlainTextContentControl의 부모 콘텐츠 컨트롤을 가져옵니다.
Public 속성 PlaceholderText 사용자 작업이나 다른 일부 작업으로 인해 텍스트가 변경될 때까지 PlainTextContentControl에 표시되는 텍스트를 가져오거나 설정합니다.
Public 속성 Range PlainTextContentControl 의 내용을 나타내는 Range를 가져옵니다.
Public 속성 ShowingPlaceholderText PlainTextContentControl 에서 현재 개체 틀 텍스트를 표시하고 있는지 여부를 지정하는 값을 가져옵니다.
Public 속성 Site IComponent 와 관련된 ISite를 가져오거나 설정합니다 . (IComponent에서 상속됨)
Public 속성 Tag PlainTextContentControl 과 연결할 문자열을 가져오거나 설정합니다.
Public 속성 Temporary 컨트롤을 편집할 때 PlainTextContentControl이 문서에서 자동으로 삭제되는지 여부를 지정하는 값을 가져오거나 설정합니다.
Public 속성 Text PlainTextContentControl 의 텍스트를 가져오거나 설정합니다.
Public 속성 Title PlainTextContentControl 의 제목을 가져오거나 설정합니다.
Public 속성 XMLMapping PlainTextContentControl 과 사용자 지정 XML 부분의 요소 사이의 바인딩을 나타내는 XMLMapping을 가져옵니다.

위쪽

메서드

  이름 설명
Public 메서드 BeginInit 초기화가 시작됨을 개체에 알립니다. (ISupportInitialize에서 상속됨)
Public 메서드 Copy 문서의 PlainTextContentControl을 클립보드에 복사합니다.
Public 메서드 Cut PlainTextContentControl 을 문서에서 제거하고 클립보드에 추가합니다.
Public 메서드 Delete 동적으로 만든 콘텐츠 컨트롤을 문서에서 삭제하고 문서의 ControlCollection에서도 제거합니다. (ContentControlBase에서 상속됨)
Public 메서드 Dispose 관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 응용 프로그램 정의 작업을 수행합니다. (IDisposable에서 상속됨)
Public 메서드 EndInit 초기화가 완료됨을 개체에 알립니다. (ISupportInitialize에서 상속됨)
Public 메서드 SetPlaceholderText BuildingBlock , Range 또는 문자열에 있는 텍스트를 PlainTextContentControl에 개체 틀 텍스트로 표시합니다.

위쪽

이벤트

  이름 설명
Public 이벤트 Added 콘텐츠 컨트롤이 문서에 추가된 후에 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 BindingContextChanged ContentControlBaseBindingContext 속성 값이 변경될 때 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 ContentUpdating 콘텐츠 컨트롤이 사용자 지정 XML 부분에 바인딩된 경우 Microsoft Office Word에서 콘텐츠 컨트롤의 텍스트를 업데이트하기 직전에 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 Deleting 콘텐츠 컨트롤이 문서에서 삭제되기 직전에 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 Disposed 구성 요소의 Disposed 이벤트를 처리하는 메서드를 나타냅니다. (IComponent에서 상속됨)
Public 이벤트 Entering 사용자가 콘텐츠 컨트롤의 안쪽을 클릭하거나 프로그래밍 방식으로 커서가 콘텐츠 컨트롤의 안쪽에 놓이면 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 Exiting 사용자가 콘텐츠 컨트롤의 바깥쪽을 클릭하거나 프로그래밍 방식으로 커서가 콘텐츠 컨트롤의 바깥쪽에 놓이면 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 StoreUpdating Microsoft Office Word에서 콘텐츠 컨트롤에 바인딩된 사용자 지정 XML 부분의 데이터를 업데이트하기 직전, 즉 콘텐츠 컨트롤의 텍스트가 변경된 후에 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 Validated 콘텐츠 컨트롤의 유효성 검사가 성공적으로 완료되었을 때 발생합니다. (ContentControlBase에서 상속됨)
Public 이벤트 Validating 콘텐츠 컨트롤의 내용에 대해 유효성을 검사할 때 발생합니다. (ContentControlBase에서 상속됨)

위쪽

설명

PlainTextContentControl에는 텍스트만 포함할 수 있습니다. PlainTextContentControl의 텍스트에 서식을 지정할 수 있지만 해당 컨트롤의 모든 텍스트에는 자동으로 동일한 서식이 적용됩니다. 예를 들어 PlainTextContentControl에 포함된 문장의 단어 하나를 기울임꼴로 표시할 경우 해당 컨트롤에 포함된 모든 텍스트가 기울임꼴로 표시됩니다.

PlainTextContentControl의 텍스트에 액세스하려면 Text 속성을 사용합니다. 기본적으로 PlainTextContentControl에는 줄 바꿈을 포함할 수 없습니다. 이 동작을 변경하려면 MultiLine 속성을 사용합니다.

텍스트와 그 밖에 표, 그림 또는 기타 콘텐츠 컨트롤을 비롯한 많은 형식의 내용을 포함할 수 있는 문서 영역을 만들려면 RichTextContentControl을 사용합니다.

참고

이 인터페이스는 Visual Studio Tools for Office Runtime에 의해 구현되며 코드에서 직접 구현할 수는 없습니다. 자세한 내용은 Visual Studio Tools for Office 런타임 개요를 참조하십시오.

콘텐츠 컨트롤

PlainTextContentControl은 Microsoft Office Word의 문서 및 서식 파일을 디자인하는 데 사용할 수 있는 8가지 콘텐츠 컨트롤 중 하나입니다. 콘텐츠 컨트롤에는 폼과 같이 입력이 제어되는 UI(사용자 인터페이스)가 있습니다. 콘텐츠 컨트롤을 사용하여 사용자가 문서 또는 서식 파일의 보호된 섹션을 편집하지 못하도록 할 수 있으며 콘텐츠 컨트롤을 데이터 소스에 바인딩할 수도 있습니다. 자세한 내용은 콘텐츠 컨트롤을 참조하십시오.

용도

이 문서에서는 .NET Framework 4를 대상으로 하는 Office 프로젝트에서 사용되는 이 형식의 버전을 설명합니다. .NET Framework 3.5를 대상으로 하는 프로젝트에서는 이 형식의 멤버가 다를 수 있으며 이 형식을 위해 제공되는 코드 예제가 작동하지 않을 수도 있습니다. .NET Framework 3.5를 대상으로 하는 프로젝트의 이 형식에 대한 문서는 Visual Studio 2008 설명서의 다음 참조 섹션을 참조하십시오. https://go.microsoft.com/fwlink/?LinkId=160658.

예제

다음 코드 예제에서는 문서의 시작 부분에 새 PlainTextContentControl을 추가합니다.

이 버전은 문서 수준 사용자 지정을 위한 것입니다. 이 코드를 사용하려면 프로젝트의 ThisDocument 클래스에 해당 코드를 붙여넣고 ThisDocument_Startup 메서드에서 AddTextControlAtSelection 메서드를 호출합니다.

Dim plainTextControl1 As Microsoft.Office.Tools.Word.PlainTextContentControl

Private Sub AddPlainTextControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Select()
    plainTextControl1 = Me.Controls.AddPlainTextContentControl("plainTextControl1")
    plainTextControl1.PlaceholderText = "Enter your first name"
End Sub
private Microsoft.Office.Tools.Word.PlainTextContentControl textControl1;

private void AddTextControlAtSelection()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Select();

    textControl1 = this.Controls.AddPlainTextContentControl("textControl1");
    textControl1.PlaceholderText = "Enter your first name";
}

이 버전은 응용 프로그램 수준 추가 기능을 위한 것입니다. 이 코드를 사용하려면 프로젝트의 ThisAddIn 클래스에 해당 코드를 붙여넣고 ThisAddIn_Startup 메서드에서 AddTextControlAtSelection 메서드를 호출합니다.

Dim plainTextControl1 As Microsoft.Office.Tools.Word.PlainTextContentControl

Private Sub AddPlainTextControlAtSelection()
    If Me.Application.ActiveDocument Is Nothing Then
        Return
    End If

    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    vstoDoc.Paragraphs(1).Range.InsertParagraphBefore()
    vstoDoc.Paragraphs(1).Range.Select()
    plainTextControl1 = vstoDoc.Controls.AddPlainTextContentControl("plainTextControl1")
    plainTextControl1.PlaceholderText = "Enter your first name"
End Sub
private Microsoft.Office.Tools.Word.PlainTextContentControl textControl1;

private void AddTextControlAtSelection()
{
    if (this.Application.ActiveDocument == null)
        return;

    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.Paragraphs[1].Range.InsertParagraphBefore();
    vstoDoc.Paragraphs[1].Range.Select();

    textControl1 = vstoDoc.Controls.AddPlainTextContentControl("textControl1");
    textControl1.PlaceholderText = "Enter your first name";
}

참고 항목

참조

Microsoft.Office.Tools.Word 네임스페이스

기타 리소스

콘텐츠 컨트롤

방법: Word 문서에 콘텐츠 컨트롤 추가

방법: 콘텐츠 컨트롤을 사용하여 문서 부분 보호

연습: 콘텐츠 컨트롤을 사용하여 서식 파일 만들기

연습: 콘텐츠 컨트롤을 사용자 지정 XML 부분에 바인딩