Unsolved QAxObject->Excel setNumberFormat does not work
-
Hello,
I tried to set the format of a date-Excel-cell.It does not work, I get always the standard format.
Its most likely not a Qt problem, but maybe someone had the same problem. Here is my code. Obj is the QAxObject* for the Cell, QString f;
Obj->setProperty("NumberFormat", f); Obj->dynamicCall("SetNumberFormat(const QString&)", f); Obj->setProperty("NumberFormatLocal", f); Obj->dynamicCall("SetNumberFormatLocal(const QString&)", f); ``` Nothing works !
-
Hi
Are you sure a Cell has SetNumberFormat ?
https://msdn.microsoft.com/en-us/library/office/ff196401.aspx
Seems to be from the Range object.Maybe something like
QAxObject * range = worksheet->querySubObject("Cells(int,int)", 1, 1);
if (!range) { qDebug()<<"range does not exist"; return };
range->dynamicCall("SetNumberFormat(const QString&)", formatStr); -
Hello @mrjj ,
I use a similar code like you. My Obj is your range of one cell.
The Obj is a correct pointer, it works, I can Obj->setProperty("Value", var);After setting the NumberFormat, I read the it and get always the german standard format "TT.MM.JJJJ hh:mm".
Obj->property("NumberFormat").toString();
PS: I there a way to find out if a ActiveX call has worked/ was accepted ?
-
I have found it, stupid error.
The format string, I simple copied from a demo code was not invalid.Nevertheless my last question stays:
I there a way to find out if a ActiveX call has worked/ was accepted ?