Important: Please read the Qt Code of Conduct -

MS Word write to field

  • Hello everyone
    I'm facing a problem when trying to write into a word's doc file text field.

    word = new QAxWidget(this);
    word->dynamicCall("Visible", true );
    //how to open a file
    QAxObject* docs = word->querySubObject( "Documents" );
    QVariant filename("c:/a.docx");
    QVariant confirmconversions(false);
    QVariant readonly(false);
    QVariant addtorecentfiles(false);
    QVariant passworddocument("");
    QVariant passwordtemplate("");
    QVariant revert(false);
    QAxObject* doc = docs->querySubObject("Open(const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)", filename, confirmconversions, readonly, addtorecentfiles, passworddocument, passwordtemplate, revert);
    QAxObject* a = doc->querySubObject("test.Text = "Hello"");

    The last line is my try to access the field.Field's name is test and the "Text" is the field's property i want to edit to insert my text.

    I would really appreciate any help cause i'm stack here for almost two weeks.

    Thank you very much

  • I'm just starting programming Qt, and here was a question about the QAxObject. How can I show it in QtextEdit or some other widget?

  • @manar_mk
    you might want to start a new thread for your question. Just start a new thread in one of the forums e.g. "General and Desktop": or whatever suits best.

  • @koahnig Thanks...

Log in to reply