ابحث ما إذا كانت قيمة الخلية تبدأ بعلامة اقتباس واحدة.
Contents
[
Hide
]
Aspose.Cells الآن يوفر خاصية Style.QuotePrefix للعثور على ما إذا كانت قيمة الخلية تبدأ بعلامة اقتباس واحدة. قبل هذه الخاصية، لم يكن هناك طريقة للتمييز بين سلاسل مثل عينة و ‘عينة وما إلى ذلك.
الشيفرة العينية التالية تشرح أن السلاسل مثل عينة و ‘عينة لا يمكن تمييزها باستخدام الخاصية Cell.StringValue. لذلك يجب علينا استخدام الخاصية Style.QuotePrefix للتمييز بينهما.
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-.NET | |
// Create workbook | |
Workbook wb = new Workbook(); | |
// Create worksheet | |
Worksheet sheet = wb.Worksheets[0]; | |
// Access cell A1 and A2 | |
Cell a1 = sheet.Cells["A1"]; | |
Cell a2 = sheet.Cells["A2"]; | |
// Add sample in A1 and sample with quote prefix in A2 | |
a1.PutValue("sample"); | |
a2.PutValue("'sample"); | |
// Print their string values, A1 and A2 both are same | |
Console.WriteLine("String value of A1: " + a1.StringValue); | |
Console.WriteLine("String value of A2: " + a2.StringValue); | |
// Access styles of A1 and A2 | |
Style s1 = a1.GetStyle(); | |
Style s2 = a2.GetStyle(); | |
Console.WriteLine(); | |
// Check if A1 and A2 has a quote prefix | |
Console.WriteLine("A1 has a quote prefix: " + s1.QuotePrefix); | |
Console.WriteLine("A2 has a quote prefix: " + s2.QuotePrefix); |