Problems using activeX and MS Word



  • Hi all, I want to create a new document and add a new table into it. But when making a DynamicCall with TablesAdd in line 15 I get an error `QVariant::QVariant(void*)' is private within this context.
    @void ChartWindow::makeWordDoc()
    {
    char const* const WordDocumentSaveAs = "SaveAs(QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&, QVariant&)";
    char const* const WordDocumentsAdd = "Add(QVariant&, QVariant&, WdNewDocumentType, QVariant&)";
    char const* const TablesAdd = "Add(QVariant&, QVariant&, QVariant&, QVariant&, QVariant&)";

    CoInitialize(NULL);
    
    QAxObject *wordApp = new QAxObject("Word.Application");
    wordApp->setProperty("Visible", true);
    QAxObject *wordDocs = wordApp->querySubObject("Documents");
    QAxObject *wordDoc = wordDocs->querySubObject(WordDocumentsAdd,"Normal",false,"wdNewBlankDocument",true);
    QAxObject *tables = wordDoc->querySubObject("Tables()");
    QAxObject *range = wordDoc->querySubObject("Range(QVariant&,QVariant&)",0,0);
    tables->dynamicCall(TablesAdd, range,3,2,"wdWord9TableBehavior","wdAutoFitWindow");
    wordDoc->dynamicCall(WordDocumentSaveAs, "d:\\text.doc");
    

    }
    @

    Thanks for any help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.