다음을 통해 공유


ControlCollection.AddContentControl 메서드 (ContentControl, String)

문서의 네이티브 콘텐츠 컨트롤을 기반으로 하는 새 ContentControl을 추가합니다.

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

구문

‘선언
Function AddContentControl ( _
    contentControl As ContentControl, _
    name As String _
) As ContentControl
ContentControl AddContentControl(
    ContentControl contentControl,
    string name
)

매개 변수

반환 값

형식: Microsoft.Office.Tools.Word.ContentControl
문서에 추가된 ContentControl입니다.

예외

예외 상황
ArgumentNullException

contentControl는 nullNull 참조(Visual Basic의 경우 Nothing)입니다.

또는

name이 nullNull 참조(Visual Basic의 경우 Nothing)이거나 길이가 0인 경우

ControlNameAlreadyExistsException

이름이 같은 컨트롤이 ControlCollection에 이미 있는 경우

ArgumentException

contentControl이 문서 블록 갤러리가 아닌 경우. 즉, contentControl의 Microsoft.Office.Interop.Word.ContentControl.Type 속성 값이 Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlRichText가 아닌 경우

설명

이 메서드를 사용하여 런타임에 문서의 네이티브 콘텐츠 컨트롤을 기반으로 하는 새 ContentControl을 추가할 수 있습니다. 이 방법은 런타임에 ContentControl을 만들고 다음에 문서를 열 때 동일한 컨트롤을 다시 만들려는 경우에 유용합니다. 자세한 내용은 런타임에 Office 문서에 컨트롤 추가을 참조하십시오.

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

ControlCollection 인터페이스

AddContentControl 오버로드

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