Trouble with QAxObject

  • Good day every one.

    I have some trouble with QAxObject’s initialization. The programm must read a .doc file, which why i use QAxObject and compare this file with some StringList. But i don’t understand whats goin on, when i try simply open my file. I look up some code examples, but they give me ERROR-Segmentation fault. Here it is:
    @QAxObject* docA = Doc->querySubObject("ActiveDocument()");
    QAxObject* words = docA->querySubObject("Words()");
    Here is full code:

    @void Dialog::WorkWithWord(QString &fileName)
    QAxObject* Word = new QAxObject("Word.Application",this);
    QAxObject* Doc = Word->querySubObject("Documents");
    Word->dynamicCall("SetVisible(bool)", false);
    Doc->dynamicCall("Open(QString&)", QString(fileName).replace("/", "\"));
    QAxObject* docA = Doc->querySubObject("ActiveDocument()");
    QAxObject* words = docA->querySubObject("Words()");
    QString textResult, searchString;
    char *found =NULL;
    int count = 0;
    int countWord = words->dynamicCall("Count()").toInt();

    for (int a=1;a<=countWord;a++)

    for (int x = 0; x < rowOfSignature.size(); ++x)
    searchString = rowOfSignature[x];
    found = strstr(textResult.toLocal8Bit().data(),searchString.toLocal8Bit().data());
    if (found)
    if (count>=3)
    else ui->textEdit_no->append(fileName);

    delete docA;
    delete Doc;
    delete words;

    And that’s all for now.

    Many thank in advance for any attention to this problem.

Log in to reply

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