Güçlü Şifreleme Türü Ayarlama C++ ile

Microsoft Excel’de Şifreleme Uygulama

Microsoft Excel’de dosya şifrelemeyi uygulamak için (örneğin 2007):

  1. Araçlar menüsünden Seçenekler‘i seçin.
  2. Güvenlik sekmesini seçin.
  3. Açmak için Parola alanı için bir değer girin.
  4. Gelişmiş‘i tıklayın.
  5. Şifreleme türünü seçin ve parolayı onaylayın.

Aspose.Cells ile Şifreleme Uygulama

Aşağıdaki kod örnekleri bir dosyaya güçlü şifreleme uygular ve bir şifre ayarlar.

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Source directory path
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Output directory path
    U16String outDir(u"..\\Data\\02_OutputDirectory\\");

    // Path of input excel file
    U16String inputFilePath = srcDir + u"Book1.xlsx";

    // Path of output excel file
    U16String outputFilePath = outDir + u"encryptedBook1.out.xls";

    // Create workbook
    Workbook workbook(inputFilePath);

    // Specify Strong Encryption type (RC4, Microsoft Strong Cryptographic Provider)
    workbook.SetEncryptionOptions(EncryptionType::StrongCryptographicProvider, 128);

    // Password protect the file
    workbook.GetSettings().SetPassword(u"1234");

    // Save the Excel file
    workbook.Save(outputFilePath);

    std::cout << "File encrypted and saved successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}