04-12-2011 10:17 PM
Hello,
I want to create table in MS Word by automation mechanism from Labview. By now, I don't have Report Generation Toolkit. So I plan to create table manually by using those automation techniques.
I have some questions guys. I don't know exactly what I should do when I use Add method. Below is documentation of MS Word API reference.
-------------------------------------------------------------------------------
Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)
expression Required. An expression that returns a Tables object.
Range Required Range object. The range where you want the table to appear. The table replaces the range, if the range isn't collapsed.
NumRows Required Long. The number of rows you want to include in the table.
NumColumns Required Long. The number of columns you want to include in the table.
DefaultTableBehavior Optional Variant. Sets a value that specifies whether Microsoft Word automatically resizes cells in tables to fit the cells’ contents (AutoFit). Can be either of the following constants: wdWord8TableBehavior (AutoFit disabled) or wdWord9TableBehavior (AutoFit enabled). The default constant is wdWord8TableBehavior.
AutoFitBehavior Optional Variant. Sets the AutoFit rules for how Word sizes tables. Can be one of the following WdAutoFitBehavior constants: wdAutoFitContent, wdAutoFitFixed, or wdAutoFitWindow. If DefaultTableBehavior is set to wdWord8TableBehavior, this argument is ignored.
-----------------------------------------------------------------------------
For sure NumRows and NumColums are Long data-type . But for DefaultTableBehaviour and AutoFitBehaviour, I have no idea how to handle it in Labview. I tried to use string constant (eq. wdWord8TableBehavior ) fed to TO VARIANT. Then the variant output is fed to DefaultTableBehavior parameter. But I found out that it didn't work.
What should I do? Many thanks.
04-12-2011 10:53 PM
You can make use of the Activex for the same. there are couple of examples that ship with LV for activex. search them and you will get a fair idea on how to achieve it
04-12-2011 11:23 PM
Thank you for your response. I've tried to use ActiveX. I have succeeded to make table in Word. But now I have problem in inserting text to the table. Labview examples don't include Word examples. Please share the code guys.
Thank you.