04-07-2007 03:10 PM
04-07-2007 05:14 PM
Hi Mike,
First off, I wanted to mention that the way LabWindows/CVI talks to Microsoft
Word is done through ActiveX. All those Word examples you see with
LabWindows/CVI are using an ActiveX generated wrapper (we created that wrapper
which is either Word2000.fp or Word97.fp and shipped it with
LabWindows/CVI). Now of course, we didn't include all the Microsoft Word
methods and properties so if you find that you are missing something, you will
need to generate your own wrapper via the ActiveX Controller Wizard.
Also, as later versions of Microsoft Word come out, if you decide you would
like to use the some of the newer methods and properties, you might need to
regenerate the wrappers. For some additionally references, check out this post
in which I responded to another customer with some additionaly helpful links.
To address your question, I am glad you found the section in the Word2000example
which is formatting the tables (around line 673 in the AddTableToDoc
function). Essentially what you need to do is get a handle to the table object
and then to the borders object. At that point, you can use the Get/Set
Properties to format the borders. For example, if you had a handle to the
document (docHandle),
then you could say
caErrChk (Word_GetProperty (docHandle, NULL,
Word_DocumentTables, CAVT_OBJHANDLE, &tablesHandle));
caErrChk (Word_GetProperty (tablesHandle, NULL, Word_TableBorders,
CAVT_OBJHANDLE, &bordersHandle);
caErrChk (Word_BordersItem (bordersHandle, NULL, -1, &borderHandle));
caErrChk (Word_SetProperty (borderHandle, NULL, Word_BorderLineStyle,
CAVT_LONG, WordConst_wdLineStyleSingle));
The big idea here is to make sure you have the appropriate references and then
use the Get/Set properties. The above code was created from that Word2000demo
shipping example (notice how the AddTableToDoc function calls the FmtAllBorders
toward the end and sends in the borders handle and some property and its value)
Hope this helps!
Best Regards,
04-09-2007 08:40 PM