'Qt ActiveX retrieving the number of pages in a word document
I am not proficient at VBA but need to use the documentation from microsoft the documentation form msdn to retrieve the number of pages in a word document.I have tried things like in the snippet below:
mWordDoc=new CustomQAxWidget("d:\\gakwandi.docx",0);
QAxObject* selection = mWordDoc->querySubObject( "Selection" );
QAxObject* pageNumbers = selection ->querySubObject( "PageNumbers" );
int numberOfPages = pageNumbers->property("Count").toInt();
But I am getting errors like QAxBase::dynamicCallHelper: PageNumbers: No such property in d:\gakwandi.docx [unknown] Candidates are:.....which suggests that I am somehow getting the syntax wrong somewhere.I was hopping someone more experienced with windows programming would hepl point out what I might be doing wrong.
Thanks.
Solution 1:[1]
In Word VBA you could check number of pages in this way:
? ActiveDocument.Range.Information(wdNumberOfPagesInDocument)
or
? ActiveDocument.Content.Information(wdNumberOfPagesInDocument)
I don't know the way to put it in C++ syntax but hope you could figure it out o your own.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kazimierz Jawor |
