다음을 통해 공유


ContentControlBase.ContentUpdating 이벤트

콘텐츠 컨트롤이 사용자 지정 XML 부분에 바인딩된 경우 Microsoft Office Word에서 콘텐츠 컨트롤의 텍스트를 업데이트하기 직전에 발생합니다.

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

구문

‘선언
Event ContentUpdating As ContentControlContentUpdatingEventHandler
event ContentControlContentUpdatingEventHandler ContentUpdating

설명

문서에 포함된 XML 부분(사용자 지정 XML 부분이라고도 함)의 요소에 콘텐츠 컨트롤을 바인딩할 수 있습니다.자세한 내용은 콘텐츠 컨트롤사용자 지정 XML 부분 개요을 참조하십시오.

ContentUpdating 이벤트는 문서가 열린 상태에서 사용자 지정 XML 부분의 데이터가 수정된 경우에만 발생합니다.문서가 열려 있고 문서가 닫혔을 때 사용자 지정 XML 부분의 데이터가 수정된 경우에는 이 이벤트가 발생하지 않습니다.

이벤트 처리에 대한 자세한 내용은 이벤트 사용를 참조하십시오.

예제

다음 코드 예제에서는 ContentUpdating 및 StoreUpdating 이벤트의 이벤트 처리기를 보여 줍니다.이 예제에서는 사용자 지정 XML 부분의 요소에 바인딩되어 있는 plainTextContentControl1이라는 PlainTextContentControl이 문서에 포함되어 있다고 가정합니다.사용자 지정 XML 부분의 요소에 콘텐츠 컨트롤을 바인딩하는 방법을 보여 주는 코드 예제는 연습: 콘텐츠 컨트롤을 사용자 지정 XML 부분에 바인딩을 참조하십시오.

이 코드를 사용하려면 프로젝트의 ThisDocument 클래스에 해당 코드를 붙여넣습니다.또한 C#의 경우 plainTextContentControl1의 ContentUpdating 및 StoreUpdating 이벤트에 이벤트 처리기를 연결해야 합니다.

이 예제는 문서 수준 사용자 지정을 위한 것입니다.

Private Sub plainTextContentControl1_StoreUpdating(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs) _
    Handles PlainTextContentControl1.StoreUpdating

    MessageBox.Show("The control was changed to the following value: " & vbCrLf & _
        e.Content & vbCrLf & "This value is about to be written to the node that is bound to this control.")
End Sub

Private Sub plainTextContentControl1_ContentUpdating(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContentControlContentUpdatingEventArgs) _
    Handles PlainTextContentControl1.ContentUpdating

    MessageBox.Show("The node that is bound to this control was changed to the following value: " & vbCrLf & _
        e.Content & vbCrLf & "This value is about to be written to this control.")
End Sub
void plainTextContentControl1_StoreUpdating(object sender, 
    Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs e)
{
    MessageBox.Show("The control was changed to the following value: \n\n" +
        e.Content + "\n\nThis value is about to be written to the node that is bound to this control.");
}

void plainTextContentControl1_ContentUpdating(object sender, 
    Microsoft.Office.Tools.Word.ContentControlContentUpdatingEventArgs e)
{
    MessageBox.Show("The node that is bound to this control was changed to the following value: \n\n" +
        e.Content + "\n\nThis value is about to be written to this control.");
}

.NET Framework 보안

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

참고 항목

참조

ContentControlBase 인터페이스

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

기타 리소스

콘텐츠 컨트롤

사용자 지정 XML 부분 개요

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