다음을 통해 공유


방법: 문서에서 맞춤법 검사

문서에서 맞춤법을 검사하려면 CheckSpelling 메서드를 사용합니다. 이 메서드는 제공된 매개 변수의 맞춤법이 정확한지 여부를 나타내는 부울 값을 반환합니다.

적용 대상: 이 항목의 정보는 Word 2007 및 Word 2010의 문서 수준 프로젝트 및 응용 프로그램 수준 프로젝트에 적용됩니다. 자세한 내용은 Office 응용 프로그램 및 프로젝트 형식에 따라 사용 가능한 기능을 참조하십시오.

맞춤법을 검사하고 결과를 메시지 상자에 표시하려면

  • CheckSpelling 메서드를 호출하고 맞춤법 오류를 검사할 텍스트의 범위를 전달합니다. 이 코드 예제를 사용하려면 프로젝트의 ThisDocument 또는 ThisAddIn 클래스에서 이 코드를 실행하십시오.

    Dim result As String = "Spelled incorrectly."
    
    If Me.Application.CheckSpelling(Me.Range.Text) = True Then
        result = "Spelled correctly."
    End If
    
    MessageBox.Show(result)
    
    string result = "Spelled incorrectly.";
    
    object startLocation = this.Content.Start;
    object endLocation = this.Content.End;
    bool spellCheck = this.Application.CheckSpelling(
        this.Range(ref startLocation, ref endLocation).Text);
    
    if (spellCheck == true)
    {
        result = "Spelled correctly.";
    }
    
    MessageBox.Show(result);
    

참고 항목

작업

방법: 문서 내의 범위 정의 및 선택

개념

Office 솔루션의 선택적 매개 변수