مشاركة عبر


WorkbookBase.ReadOnly الخاصية

الحصول على القيمة تشير إلى ما إذا كان h مصنف كـ تم فتح كـ القراءة فقط.

مساحة الاسم:  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.

أمثلة

التعليمة البرمجية التالية مثال dهوplays رسالة إذا ReadOnlyRecommendedخاصية هو trueو ReadOnlyهو خاصية false، وثم بمطالبة مستخدم بتعيين الوصول إلى ملف القراءة فقط بواسطة استدعاء ChangeFileAccessالأسلوب.

Th هو المثال هو لتخصيص المستوى مستند.

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 الفئة

WorkbookBase الأعضاء

Microsoft.Office.Tools.Excel مساحة الاسم