Share via


WorkbookBase.ReadOnlyRecommended 속성

통합 문서가 읽기 전용 권장 모드로 저장되었는지 여부를 나타내는 값을 가져오거나 설정합니다.

네임스페이스:  Microsoft.Office.Tools.Excel
어셈블리:  Microsoft.Office.Tools.Excel.v4.0.Utilities(Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

구문

‘선언
Public Property ReadOnlyRecommended As Boolean
    Get
    Set
public bool ReadOnlyRecommended { get; set; }

속성 값

형식: System.Boolean
통합 문서가 읽기 전용 권장 모드로 저장되었으면 true이고, 그렇지 않으면 false입니다.

설명

읽기 전용 권장 모드로 저장된 통합 문서를 열면 Microsoft Office Excel에서 통합 문서를 읽기 전용으로 여는 것이 좋다는 메시지가 표시됩니다.

이 속성을 변경하려면 SaveAs 메서드를 사용합니다.

예제

다음 코드 예제에서는 ReadOnlyRecommended 속성이 true이고 ReadOnly 속성이 false인 경우 ChangeFileAccess 메서드를 호출하여 사용자에게 파일 액세스 권한을 읽기 전용으로 설정할지 묻는 메시지 상자를 표시합니다.

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

Private Sub MakeWorkbookReadOnly()
    If Me.ReadOnlyRecommended AndAlso Not Me.ReadOnly Then
        ' Change the access level of the document to read-only  
        ' if the user clicks yes.
        If MessageBox.Show("Set this document to read-only?", _
            "Sample", MessageBoxButtons.YesNo) = DialogResult.Yes Then
            Me.ChangeFileAccess(Excel.XlFileAccess.xlReadOnly, Notify:=False)
        End If
    End If
End Sub
private void MakeWorkbookReadOnly()
{
    if (this.ReadOnlyRecommended && !this.ReadOnly)
    {
        // Change the access level of the document to read-only if the user 
        // clicks yes.
        if (MessageBox.Show("Set this document to read-only?",
            "Sample", MessageBoxButtons.YesNo) == DialogResult.Yes)
        {
            this.ChangeFileAccess(Excel.XlFileAccess.xlReadOnly,
                missing, false);
        }
    }
}

.NET Framework 보안

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

참고 항목

참조

WorkbookBase 클래스

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