Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
sample and 'sample, etc.
The following sample code demonstrates that strings like sample and 'sample cannot be differentiated using the Cell::GetStringValue property. Therefore, we must use the Style::QuotePrefix property to distinguish them.
#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 cells 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 are both the 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 have 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();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.