다음을 통해 공유


GroupContentControl 클래스(2007 시스템)

업데이트: 2008년 7월

문서에서 사용자가 편집하거나 삭제할 수 없는 보호된 영역을 나타냅니다.

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

구문

<DefaultBindingPropertyAttribute("Text")> _
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public NotInheritable Class GroupContentControl _
    Inherits ContentControlBase _
    Implements ISupportInitializeControl, ISupportInitialize

Dim instance As GroupContentControl
[DefaultBindingPropertyAttribute("Text")]
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public sealed class GroupContentControl : ContentControlBase, 
    ISupportInitializeControl, ISupportInitialize

설명

GroupContentControl을 사용하여 문서에서 사용자가 편집하거나 삭제할 수 없는 보호된 영역을 정의할 수 있습니다. GroupContentControl에는 텍스트, 표, 그래픽 및 기타 콘텐츠 컨트롤과 같은 문서 항목이 들어 있을 수 있습니다. GroupContentControl에서는 사용자에게 표시되는 UI를 제공하지 않습니다. GroupContentControl을 사용하여 문서의 일부분을 보호하는 방법에 대한 자세한 내용은 콘텐츠 컨트롤방법: 콘텐츠 컨트롤을 사용하여 문서 부분 보호를 참조하십시오.

콘텐츠 컨트롤

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

예제

다음 코드 예제에서는 문서의 처음 부분에 새 단락을 추가하고 이 단락이 포함된 새 GroupContentControl을 만듭니다. GroupContentControl은 사용자가 단락의 텍스트를 편집하지 못하도록 합니다.

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

Dim groupControl1 As Microsoft.Office.Tools.Word.GroupContentControl

Private Sub AddGroupControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "You cannot edit or change the formatting of text " & _
            "in this paragraph, because this paragraph is in a GroupContentControl."
    Me.Paragraphs(1).Range.Select()
    groupControl1 = Me.Controls.AddGroupContentControl("groupControl1")
End Sub
private Microsoft.Office.Tools.Word.GroupContentControl groupControl1;

private void AddGroupControlAtSelection()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Word.Range range1 = this.Paragraphs[1].Range;
    range1.Text = "You cannot edit or change the formatting of text " +
        "in this paragraph, because this paragraph is in a GroupContentControl.";
    range1.Select();

    groupControl1 = this.Controls.AddGroupContentControl("groupControl1");
}

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

Dim groupControl1 As Microsoft.Office.Tools.Word.GroupContentControl

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

    Dim vstoDoc As Document = Me.Application.ActiveDocument.GetVstoObject()
    vstoDoc.Paragraphs(1).Range.InsertParagraphBefore()
    vstoDoc.Paragraphs(1).Range.Text = "You cannot edit or change the formatting of text " & _
            "in this paragraph, because this paragraph is in a GroupContentControl."
    vstoDoc.Paragraphs(1).Range.Select()
    groupControl1 = vstoDoc.Controls.AddGroupContentControl("groupControl1")
End Sub
private Microsoft.Office.Tools.Word.GroupContentControl groupControl1;

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

    Document vstoDoc = this.Application.ActiveDocument.GetVstoObject();
    vstoDoc.Paragraphs[1].Range.InsertParagraphBefore();
    Word.Range range1 = vstoDoc.Paragraphs[1].Range;
    range1.Text = "You cannot edit or change the formatting of text " +
        "in this paragraph, because this paragraph is in a GroupContentControl.";
    range1.Select();

    groupControl1 = vstoDoc.Controls.AddGroupContentControl("groupControl1");
}

상속 계층 구조

System.Object
  Microsoft.VisualStudio.Tools.Office.RemoteComponent
    Microsoft.VisualStudio.Tools.Office.RemoteBindableComponent
      Microsoft.Office.Tools.Word.ContentControlBase
        Microsoft.Office.Tools.Word.GroupContentControl

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

참고 항목

참조

GroupContentControl 멤버

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

기타 리소스

콘텐츠 컨트롤

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

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

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

변경 기록

날짜

변경 내용

이유

2008년 7월

응용 프로그램 수준 추가 기능의 코드 예제 버전이 추가되었습니다.

SP1 기능 변경