Ottenere la convalida applicata su una cella
È possibile utilizzare Aspose.Cells per Python via .NET per ottenere la convalida applicata a una cella. Aspose.Cells per Python via .NET fornisce il metodo Cell.get_validation() a tale scopo. Se non è stata applicata alcuna convalida sulla cella, restituisce null.
Allo stesso modo, è possibile utilizzare il metodo Worksheet.validations.get_validation_in_cell per acquisire la convalida applicata a una cella fornendo i suoi indici di riga e colonna.
codice Python per ottenere la convalida applicata su una cella
Nella seguente esempio di codice, ti mostra come ottenere la convalida applicata su una cella.
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Instantiate the workbook from sample Excel file | |
workbook = Workbook("sample.xlsx") | |
# Access its first worksheet | |
worksheet = workbook.worksheets[0] | |
# Cell C1 has the Decimal Validation applied on it. It can take only the values Between 10 and 20 | |
cell = worksheet.cells.get("C1") | |
# Access the valditation applied on this cell | |
validation = cell.get_validation() | |
# Read various properties of the validation | |
print("Reading Properties of Validation") | |
print("--------------------------------") | |
print("Type: " + str(validation.type)) | |
print("Operator: " + str(validation.operator)) | |
print("Formula1: " + validation.formula1) | |
print("Formula2: " + validation.formula2) | |
print("Ignore blank: " + str(validation.ignore_blank)) |