Insert list in Word documment using qaxobject
-
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
-
@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.
-
@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?
-
@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. -
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.