مشاركة عبر


WorkbookBase.SetPasswordEncryptionOptions أسلوب

قم بتعيين خيارات تشفير مصنف باستخدام كلمة المرور.

مساحة الاسم:  Microsoft.Office.Tools.Excel
التجميع:  Microsoft.Office.Tools.Excel.v4.0.Utilities (في Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

بناء الجملة

'إقرار
Public Sub SetPasswordEncryptionOptions ( _
    passwordEncryptionProvider As Object, _
    passwordEncryptionAlgorithm As Object, _
    passwordEncryptionKeyLength As Object, _
    passwordEncryptionFileProperties As Object _
)
public void SetPasswordEncryptionOptions(
    Object passwordEncryptionProvider,
    Object passwordEncryptionAlgorithm,
    Object passwordEncryptionKeyLength,
    Object passwordEncryptionFileProperties
)

المعلمات

  • passwordEncryptionProvider
    النوع: System.Object
    أ تحسس حالة الأحرف سلسلة موفر تشفير.
  • passwordEncryptionAlgorithm
    النوع: System.Object
    أ حالة الحساسة سلسلة قصير algorithmic الاسم (على سبيل المثال:"rc4 ").
  • passwordEncryptionKeyLength
    النوع: System.Object
    الطول مفتاح التشفير، الذي هو مضاعف 8 (40 أو أكبر).
  • passwordEncryptionFileProperties
    النوع: System.Object
    true(افتراضي) إلى تشفير خصائص الملف.

ملاحظات

PasswordEncryptionProvider، PasswordEncryptionAlgorithm، و PasswordEncryptionKeyLengthمعلمات غير مستقلة عن بعضها البعض. موفر خدمة تشفير محدد بتحديد التعيين خوارزميات و مفتاح الطول التي يمكن اختيارها.

ل PasswordEncryptionKeyLengthمعلمة هو الناتجة عن حدود نطاق الطول المفتاح. النطاق هو تعريفه بواسطة "موفر الخدمة التشفير" الذي يحدد خوارزمية التشفير أيضا.

المعلمات الإختيارية

ل معلومات تشغيل معلمات اختيارية، راجع يفتقد المتغير و "المعلمات الاختيارية" في حلول Office.

أمثلة

مثال التعليمة البرمجية التالية بفحص القيمة HasPasswordخاصية لتحديد ما إذا كان مصنف هو محمي بكلمة مرور. إذا ليس مصنف محمي بكلمة مرور، ثم يعين المثال Passwordخاصية على كلمة مرور تم الحصول عليها من إدخال مستخدم، ومن ثم استدعاء SetPasswordEncryptionOptionsالأسلوب لتعيين خوارزمية التشفير، قم بتعيين الطول المفتاح وتعيين اسم موفر التشفير وتمكين ملف خاصية التشفير. مثال ثم يقوم بعرض قيم PasswordEncryptionProvider، PasswordEncryptionAlgorithm، PasswordEncryptionKeyLength، و PasswordEncryptionFilePropertiesالخصائص في ورقة عمل Sheet1. Th هو فرض التي أسلوب GetPasswordFromUserInputهو المعرفة في أي مكان آخر.

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

Private Sub WorkbookPasswordOptions()
    If Not Me.HasPassword Then
        Me.Password = GetPasswordFromUserInput()
        Me.SetPasswordEncryptionOptions( _
            "Microsoft RSA SChannel Cryptographic Provider", _
            "RC4", 128, True)
    End If

    ' Display the password properties in Sheet1.
    Globals.Sheet1.Range("A1").Value2 = _
        "Password Encryption Provider:"
    Globals.Sheet1.Range("A2").Value2 = _
        "Password Encryption Algorithm:"
    Globals.Sheet1.Range("A3").Value2 = _
        "Password Encryption Key Length:"
    Globals.Sheet1.Range("A4").Value2 = _
        "Password Encryption File Properties:"
    Globals.Sheet1.Range("A1", "A4").Columns.AutoFit()

    Globals.Sheet1.Range("B1").Value2 = _
        Me.PasswordEncryptionProvider
    Globals.Sheet1.Range("B2").Value2 = _
        Me.PasswordEncryptionAlgorithm
    Globals.Sheet1.Range("B3").Value2 = _
        Me.PasswordEncryptionKeyLength
    Globals.Sheet1.Range("B4").Value2 = _
        Me.PasswordEncryptionFileProperties
    Globals.Sheet1.Range("B1", "B4").Columns.AutoFit()
End Sub
private void WorkbookPasswordOptions()
{
    if (!this.HasPassword)
    {
        this.Password = GetPasswordFromUserInput();
        this.SetPasswordEncryptionOptions(
            "Microsoft RSA SChannel Cryptographic Provider",
            "RC4", 128, true);
    }

    // Display the password properties in Sheet1.
    Globals.Sheet1.Range["A1", missing].Value2 =
        "Password Encryption Provider:";
    Globals.Sheet1.Range["A2", missing].Value2 =
        "Password Encryption Algorithm:";
    Globals.Sheet1.Range["A3", missing].Value2 =
        "Password Encryption Key Length:";
    Globals.Sheet1.Range["A4", missing].Value2 =
        "Password Encryption File Properties:";
    Globals.Sheet1.Range["A1", "A4"].Columns.AutoFit();

    Globals.Sheet1.Range["B1", missing].Value2 =
        this.PasswordEncryptionProvider;
    Globals.Sheet1.Range["B2", missing].Value2 =
        this.PasswordEncryptionAlgorithm;
    Globals.Sheet1.Range["B3", missing].Value2 =
        this.PasswordEncryptionKeyLength;
    Globals.Sheet1.Range["B4", missing].Value2 =
        this.PasswordEncryptionFileProperties;
    Globals.Sheet1.Range["B1", "B4"].Columns.AutoFit();
}

أمن NET Framework.

راجع أيضًَا

المرجع

WorkbookBase الفئة

WorkbookBase الأعضاء

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