Hücre değeri tek tırnak işaretiyle başlıyorsa, C++ ile bulma
Contents
[
Hide
]
Aşağıdaki örnek kod, ‘örnek’ ve ‘örnek gibi örneğin’ gibi stringler arasında ayrım yapmanın {0} özelliği ile mümkün olamayacağını açıklar. Bu nedenle, onları ayırt etmek için {1} özelliğini kullanmalıyız.
Aşağıdaki örnek kod, örnek ve ‘örnek gibi dizilerin Cell::GetStringValue özelliği ile ayırt edilemeyeceğini açıklar. Bu nedenle onları ayırt etmek için Style::QuotePrefix özelliğini kullanmamız gerekir.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create workbook
Workbook wb;
// Create worksheet
Worksheet sheet = wb.GetWorksheets().Get(0);
// Access cell A1 and A2
Cell a1 = sheet.GetCells().Get(u"A1");
Cell a2 = sheet.GetCells().Get(u"A2");
// Add sample in A1 and sample with quote prefix in A2
a1.PutValue(u"sample");
a2.PutValue(u"'sample");
// Print their string values, A1 and A2 both are same
std::cout << "String value of A1: " << a1.GetStringValue().ToUtf8() << std::endl;
std::cout << "String value of A2: " << a2.GetStringValue().ToUtf8() << std::endl;
// Access styles of A1 and A2
Style s1 = a1.GetStyle();
Style s2 = a2.GetStyle();
std::cout << std::endl;
// Check if A1 and A2 has a quote prefix
std::cout << "A1 has a quote prefix: " << s1.GetQuotePrefix() << std::endl;
std::cout << "A2 has a quote prefix: " << s2.GetQuotePrefix() << std::endl;
Aspose::Cells::Cleanup();
}