Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Insert list in Word documment using qaxobject
Forum Updated to NodeBB v4.3 + New Features

Insert list in Word documment using qaxobject

Scheduled Pinned Locked Moved Unsolved General and Desktop
qaxobjectqaxwidgetdocumentation
5 Posts 2 Posters 675 Views
  • 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.
  • R Offline
    R Offline
    Rigoberto
    wrote on 28 May 2023, 22:22 last edited by
    #1

    How can I insert a list (numbered or not) in a Word document using QAxobject?

    generatedocumentation requieres an object name but in this case I don't known what's the object name. I tried with word.application, selection, paragraphs, ....

    Thanks in advanced

    C 1 Reply Last reply 29 May 2023, 01:48
    0
    • R Rigoberto
      28 May 2023, 22:22

      How can I insert a list (numbered or not) in a Word document using QAxobject?

      generatedocumentation requieres an object name but in this case I don't known what's the object name. I tried with word.application, selection, paragraphs, ....

      Thanks in advanced

      C Offline
      C Offline
      ChrisW67
      wrote on 29 May 2023, 01:48 last edited by
      #2

      @Rigoberto Looks like you want the Word.Paragraph.startNewList() to get a Word.List object. You can then call Word.List.insertParagraph() to insert items, and other methods to format etc.

      R 1 Reply Last reply 29 May 2023, 20:02
      1
      • C ChrisW67
        29 May 2023, 01:48

        @Rigoberto Looks like you want the Word.Paragraph.startNewList() to get a Word.List object. You can then call Word.List.insertParagraph() to insert items, and other methods to format etc.

        R Offline
        R Offline
        Rigoberto
        wrote on 29 May 2023, 20:02 last edited by
        #3

        @ChrisW67 thanks. I try with following code:

        QAxWidget *word = new QAxWidget("Word.App...
        QAxObject *docs = new QAxObject;
        docs = word->querySubObject("Documents");
        docs->dynamicCall("Open(...
        QAxObject *doc = word->querySubObject("ActiveDoc...
        QAxObject *p = doc->querySubObject("Paragraphs(1)");
        QAxObject *l = p->querySubObject("startNewList()");

        But Word crashes :(

        What am I doing wrong?

        C 1 Reply Last reply 30 May 2023, 07:12
        0
        • R Rigoberto
          29 May 2023, 20:02

          @ChrisW67 thanks. I try with following code:

          QAxWidget *word = new QAxWidget("Word.App...
          QAxObject *docs = new QAxObject;
          docs = word->querySubObject("Documents");
          docs->dynamicCall("Open(...
          QAxObject *doc = word->querySubObject("ActiveDoc...
          QAxObject *p = doc->querySubObject("Paragraphs(1)");
          QAxObject *l = p->querySubObject("startNewList()");

          But Word crashes :(

          What am I doing wrong?

          C Offline
          C Offline
          ChrisW67
          wrote on 30 May 2023, 07:12 last edited by
          #4

          @Rigoberto Could you please post complete code?

          Have you included the Word typelib in the TYPELIBS variable? I think the CLSID would be
          {00020906-0000-0000-C000-000000000046}
          but I do not have Windows machine or Word to look at. See here for a similar example. Getting this bit right will make navigating the Word API much more straightforward for most cases by generating C++ class wrappers.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rigoberto
            wrote on 1 Jun 2023, 12:20 last edited by
            #5

            Thank you Chris.

            I solved it by generating a text file with instructions in vbscript and executing it afterwards. With this variant I can manipulate word documents more easily but it only works for Windows.

            It's not that efficient but I have a lot more documentation for working with word.application in vbscript.

            I reiterate my thanks for answering me so quickly.

            1 Reply Last reply
            0

            4/5

            30 May 2023, 07:12

            • Login

            • Login or register to search.
            4 out of 5
            • First post
              4/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved