Share via


WorkbookBase.ReadOnly 속성

통합 문서가 읽기 전용으로 열려 있는지 여부를 나타내는 값을 가져옵니다.

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

구문

‘선언
Public ReadOnly Property ReadOnly As Boolean
    Get
public bool ReadOnly { get; }

속성 값

형식: System.Boolean
통합 문서가 읽기 전용으로 열려 있으면 true이고, 그렇지 않으면 false입니다.

설명

이 속성은 SharePoint 사이트에 연결된 목록에만 사용할 수 있습니다.

예제

다음 코드 예제에서는 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 네임스페이스