Angewendete Validierung auf einer Zelle erhalten.
Contents
[
Hide
]
Sie können Aspose.Cells für Python via .NET verwenden, um die auf eine Zelle angewendete Validierung zu erhalten. Aspose.Cells für Python via .NET bietet hierfür die Methode Cell.get_validation(). Wenn auf die Zelle keine Validierung angewendet ist, gibt sie null zurück.
Ebenso können Sie die Worksheet.validations.get_validation_in_cell Methode verwenden, um die auf eine Zelle angewendete Validierung durch Angabe ihrer Zeilen- und Spaltenindizes zu erhalten.
Python-Code, um die auf eine Zelle angewendete Validierung zu erhalten
Im folgenden Beispielcode sehen Sie, wie Sie die auf eine Zelle angewendete Validierung erhalten können.
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
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)) |