Qt World Summit: Submit your Presentation

Qt ActiveX retrieving the number of pages in a word document

  • Hi,
    I am not proficient at VBA but need to use the documentation from "microsoft":http://msdn.microsoft.com/en-us/library/office/ff839342.aspx the documentation form msdn][1] 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 this would hep point out what I might be doing wrong.


Log in to reply