ابحث ما إذا كانت قيمة الخلية تبدأ بعلامة اقتباس واحدة.
Contents
[
Hide
]
Aspose.Cells for Python via .NET يوفر الآن الخاصية Style.quote_prefix للعثور عما إذا كانت قيمة الخلية تبدأ بعلامة اقتباس مفردة. قبل هذه الخاصية ، لم يكن هناك طريقة للتمييز بين السلاسل مثل عينة و ‘عينة’، وما إلى ذلك.
الشيفرة العينية التالية تشرح أن السلاسل مثل عينة و ‘عينة لا يمكن تمييزها باستخدام الخاصية Cell.string_value. لذلك يجب علينا استخدام الخاصية Style.quote_prefix للتمييز بينهما.
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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Create workbook | |
wb = Workbook() | |
# Create worksheet | |
sheet = wb.worksheets[0] | |
# Access cell A1 and A2 | |
a1 = sheet.cells.get("A1") | |
a2 = sheet.cells.get("A2") | |
# Add sample in A1 and sample with quote prefix in A2 | |
a1.put_value("sample") | |
a2.put_value("'sample") | |
# Print their string values, A1 and A2 both are same | |
print("String value of A1: " + a1.string_value) | |
print("String value of A2: " + a2.string_value) | |
# Access styles of A1 and A2 | |
s1 = a1.get_style() | |
s2 = a2.get_style() | |
print() | |
# Check if A1 and A2 has a quote prefix | |
print("A1 has a quote prefix: " + str(s1.quote_prefix)) | |
print("A2 has a quote prefix: " + str(s2.quote_prefix)) |