Çalışma Sayfasının Parola Korumalı olup olmadığını algıla
Contents
[
Hide
]
Çalışma kitaplarını ve çalışma sayfalarını ayrı ayrı korumak mümkündür. Örneğin, bir elektronik tablo parola korumalı bir veya daha fazla çalışma sayfası içerebilir, ancak elektronik tablonun kendisi korumalı olabilir veya olmayabilir. Aspose.Cells API’ler, belirli bir çalışma sayfasının parola korumalı olup olmadığını algılamak için araçlar sağlar. Bu makale, aynı şeyi elde etmek için Aspose.Cells for .NET API kullanımını göstermektedir.
Aspose.Cells for .NET 8.7.0 ifşa ettiProtection.IsProtectedWithPassword çalışma sayfasının parola korumalı olup olmadığını algılama özelliği. Boole tipiProtection.IsProtectedWithPassword mülkiyet iadeleridoğru EğerÇalışma kağıdı parola korumalıdır veYANLIŞ değilse.
This file contains hidden or 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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create an instance of Workbook and load a spreadsheet | |
var book = new Workbook(dataDir + "sample.xlsx"); | |
// Access the protected Worksheet | |
var sheet = book.Worksheets[0]; | |
// Check if Worksheet is password protected | |
if (sheet.Protection.IsProtectedWithPassword) | |
{ | |
Console.WriteLine("Worksheet is password protected"); | |
} | |
else | |
{ | |
Console.WriteLine("Worksheet is not password protected"); | |
} |