QAxObject format Excel cell
-
Hi,
I'm using Qt 5.11 and C++.
The question is hot format Excel cells to be as a text.
E.g., if I set the value to 1.1, then it gets converted to date.
The output of this code snippet is:
Set value to "1.1"
"01.jaan"QAxObject* cell = sheet->querySubObject("Cells(int,int)", row, col); if (cell != nullptr) { QString testValue = QString("%1.%2").arg(row).arg(col); qDebug() << "Set value to" << testValue; cell->setProperty("Value", testValue); QString newValue = cell->dynamicCall("Text()").toString(); qDebug() << newValue; } -
@VRonin
Hi. I assumed this (the leading') would be the answer.But I am also intrigued. I don't want to go look up the Excel docs, which is where this comes from. Do you know why Excel treats an unquoted
1.1as a date rather than a floating point number? My thought would be that although one does sometimes type dates into cells, it is considerably more likely to type a floating point number (e.g. a price), so seems strange to me that the default interpretation is selected as date rather than number? -
@VRonin
Hi. I assumed this (the leading') would be the answer.But I am also intrigued. I don't want to go look up the Excel docs, which is where this comes from. Do you know why Excel treats an unquoted
1.1as a date rather than a floating point number? My thought would be that although one does sometimes type dates into cells, it is considerably more likely to type a floating point number (e.g. a price), so seems strange to me that the default interpretation is selected as date rather than number? -
From
@Indrek-M said in QAxObject format Excel cell:
"01.jaan"
Google tells me this is Estonian and
QLocale(QLocale::Estonian,QLocale::Estonia).decimalPoint()returns,that's why.is not interpreted as a decimal point