Çalışma sayfasının Parola Korumalı Olup Olmadığını Algılama
Contents
[
Hide
]
Çalışma kitaplarını ve çalışma kitaplarını ayrı ayrı koruma olasılığı vardır. Örneğin, bir elektronik tablo, şifreyle korunan bir veya daha fazla çalışma sayfası içerebilir, ancak elektronik tablo kendisi korunmuş olabilir veya olmayabilir. Aspose.Cells API’leri, belirli bir çalışma sayfasının şifre korunup korunmadığını belirleme olanağı sağlar. Bu makale, Aspose.Cells for Java API’nin aynı şeyi başarmak için nasıl kullanıldığını göstermektedir.
Çalışma Sayfasının Şifre Korunup Korunmadığını Algılama
Aspose.Cells for Java 8.7.0’nin Protection.isProtectedWithPassword özelliği şimdi bir çalışma kitabının parola korumalı olup olmadığını algılamak için kullanılabilir. Boolean türü Protection.isProtectedWithPassword alanı, Worksheet parola korumalıysa true değerini döndürür, aksi halde false değerini döndürür.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = Utils.getDataDir(DetectWorksheetisPasswordProtected.class); | |
// Create an instance of Workbook and load a spreadsheet | |
Workbook book = new Workbook(dataDir + "sample.xlsx"); | |
// Access the protected Worksheet | |
Worksheet sheet = book.getWorksheets().get(0); | |
// Check if Worksheet is password protected | |
if (sheet.getProtection().isProtectedWithPassword()) { | |
System.out.println("Worksheet is password protected"); | |
} |