Excel Dosyalarını Şifrelemek ve Çözmek
MS Excel Kullanarak
MS Excel’de (örneğin MS Excel 2003), dosya şifreleme ayarlarını gerçekleştirmek için şunları deneyebilirsiniz:
- Araçlar menüsünden Seçenekler‘i seçin ve ardından Güvenlik sekmesini seçin.
- Açmak için Şifre‘yi girin ve Gelişmiş düğmesine tıklayın.
- Şifreleme türünü seçin ve şifreyi doğrulayın.

Şekil: Seçenekler iletişim kutusu

Şekil: Şifreleme Türü iletişim kutusu
Excel dosyası şifreleme
Aşağıdaki örnek, Aspose.Cells API’sını kullanarak bir Excel dosyasını şifrelemenin / parolayla korumanın nasıl yapılabileceğini göstermektedir.
Örnek Kod:
| // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
| // The path to the documents directory. | |
| String dataDir = "./"; | |
| // Instantiate a Workbook object by excel file path | |
| Workbook workbook = new Workbook(dataDir + "Book1.xls"); | |
| // Password protect the file. | |
| workbook.getSettings().setPassword("1234"); | |
| // Specify XOR encrption type. | |
| workbook.setEncryptionOptions(EncryptionType.XOR, 40); | |
| // Specify Strong Encryption type (RC4,Microsoft Strong Cryptographic | |
| // Provider). | |
| workbook.setEncryptionOptions(EncryptionType.STRONG_CRYPTOGRAPHIC_PROVIDER, 128); | |
| // Save the excel file. | |
| workbook.save(dataDir + "EncryptingFiles_out.xls"); | |
| // Print message | |
| System.out.println("Encryption applied successfully on output file."); |
Aspose.Cells ile Excel dosyasının şifresini çözme
Koruma altındaki Excel dosyasını açmak ve Aspose.Cells API’sını kullanarak aşağıdaki kodları kullanarak şifresini çözmek çok kolaydır:
| //Open encrypted file with password. | |
| LoadOptions loadOptions = new LoadOptions(); | |
| loadOptions.setPassword("password"); | |
| Workbook workbook = new Workbook("Book1.xlsx", loadOptions); | |
| //Remove password. | |
| workbook.getSettings().setPassword(null); | |
| //Save the file. | |
| workbook.save("Book1.xlsx"); |