08-18-2005 04:10 AM
Hi Dave,
Before I try what you suggested - I only have Microsoft Word 9.0 object library.
Is it important to have version 10.0? If so, how can I get it? Is it downloadable?
Thanx!
---J
08-18-2005 08:05 AM
Hi Jojo,
The object library that you have should depend on the version of Office that you have installed on your machine. When you say you only have word9.0 do you mean that is the only object library you are able to see/build from 'Tools->Create ActiveX Controller' menu, or do you mean that is the only one that you physically have built on your machine?
When you install Word 2002 it should automatically register the 10.0 object library. The way you can get this object library on your machine is to go to 'Tools->Create ActiveX Controller'. You can select the MS Word 10. object library and build it from there. At some point you must have had this object library built because you mentioned the 'Word_ApplicationGetDocuments' that you cannot find, which is a function present in the 10.0 object library and not the 9.0 object library.
I know at one point you had uninstalled Word 2002 and only had word 2000 on the machine, is this still the case?
08-19-2005 12:56 AM
08-19-2005 03:37 PM - edited 08-19-2005 03:37 PM
Hi Jojo,
Well, this problem just keeps getting trickier and tricker :-).
I think that you should be fine with the 9.0 controls as long as you have word 2000 or before.
1.) In the HRESULT CVIFUNC WordRpt_DocumentNew(CAObjHandle appHandle, char template[], CAObjHandle *docHandle) function, what do you pass in as a value for 'template' argument?
2.) Have you tried running the word2000demo that comes with labwindows and seen if it works? If it does, try using the following code in your program. For right now, just comment out any functions coming from the WordReport .fp right now, and lets see if we can get this to work without it (WordReport is basically just a bunch of wrapper classes for the Word9.0 object library anyway):
//Open Word
Word_NewApplication (NULL, 1, LOCALE_NEUTRAL, 0, &appHandle);
//Make word visible
Word_SetProperty (appHandle, NULL, Word_ApplicationVisible,
CAVT_BOOL, VTRUE)
//Get the word documents handle
Word_GetProperty (appHandle, NULL,
Word_ApplicationDocuments,
CAVT_OBJHANDLE, &docsHandle);
//Add the new word document
Word_DocumentsAddOld (docsHandle, NULL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, &docHandle)
Message Edited by DaveC on 08-19-2005 03:38 PM
08-21-2005 04:57 AM - edited 08-21-2005 04:57 AM
Hi Dave,
We've made progress!!! congradulations ![]()
I checked the "template" parameter, and I remembered you once told me that the filename should contain an absolute path, so I altered it, and now I am successful in opening the document!
However, there is still a problem: My document conatins tables, and I keep getting this error string-- "No such interface supported"
So I looked into it, and I found that there is a call to the function: WordRpt_SetRowHeight, (from within WordRpt_InsertCVITable)
This function contains the call:
errChk (Word_RowsSetHeight (rowHandleL, NULL, newRowHeight,
WordConst_wdRowHeightExactly));
This call returns the error code I mentioned above.
Hope you have more ideas...
Anyway, congrats again 🙂
Message Edited by Jojo9999 on 08-21-2005 04:58 AM
08-22-2005 02:08 AM
PS
I'm now working with office XP
08-22-2005 02:27 AM
08-23-2005 12:04 PM
08-28-2005 02:36 AM - edited 08-28-2005 02:36 AM
Hi, Dave
Well, I succeeded!!!
It was much thanks to you!
To sum up, here are the main fixes required:
1. The path of the template file (which I'm opening with word) had to be absolute
2. I used an older version of Wordreport.c (function starting with WordRpt_), so although it compiled okay, many functions (such as RowSetHeight) returned an error. Had to get a newer version of WordReport (came with the new CVI). ALWAYS USE THE DEMO (was my conclusion)
3. There was no need to re-create the ActiveX object for Office XP. The one for Word2000 was enough.
So, Thanx very much! ![]()
JM
P.S
I have a new problem with Excel , So I'm starting a new thread. Happy if you can help there too.
Message Edited by Jojo9999 on 08-28-2005 02:38 AM
Message Edited by Jojo9999 on 08-28-2005 02:38 AM
08-29-2005 02:20 PM