Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trouble with QAxObject
Qt 6.12 LTS is out! See what's new in the release blog

Trouble with QAxObject

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 688 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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++)
    {
        textResult.append(words->querySubObject("Item(int)",a)->dynamicCall("Text()").toString());
    }
    

    ui->plainTextEdit->appendPlainText(textResult);
    for (int x = 0; x < rowOfSignature.size(); ++x)
    {
    searchString = rowOfSignature[x];
    found = strstr(textResult.toLocal8Bit().data(),searchString.toLocal8Bit().data());
    if (found)
    count++;
    }
    if (count>=3)
    ui->textEdit_yes->append(fileName);
    else ui->textEdit_no->append(fileName);
    Doc->querySubObject("ActiveDocument")->dynamicCall("Close()");
    Word->dynamicCall("Quit()");

    delete docA;
    delete Doc;
    delete words;
    }@

    And that’s all for now.

    Many thank in advance for any attention to this problem.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved