LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add rows to table as required using Word Template

Solved!
Go to solution

Hey All

 

I am trying to create a flexible MS Word Word Report Template for my program. I am using a Template file and bookmarks because it allows me to set individual widths for the columns of my data and more control over the appearance in general. However, the number of rows of data I will have will vary depending on the test case, it could be anywhere from 1 to 100 rows. Is there any way to programmatically control this? I found that if my template file table/bookmark defaults to say 10 rows, and I have 12 rows of data from an array, that rows 10, 11 are clobbered. I don't want to set my default template to 100+ rows and have a bunch of blank rows for the smaller test cases. I have tried both using the MS Word express VI, and manually configuring a new  Test Report, but can't figure it out.

 

I did find this thread:

https://forums.ni.com/t5/LabVIEW/Adding-lines-to-a-Table-Word-Template/td-p/1051395

But it is from 2010, and I can't find a record of the issue still being active.

 

This is LabVIEW 2017 Full.

 

Thanks!

0 Kudos
Message 1 of 5
(3,028 Views)

Hi David,

 

there might be a better solution than this, but here's how I usually solve this:

I create a bookmark on a blank page, same way you would when inserting a block of text. During the test, I save all the data that needs to go into the table in an array (of cluster or directly the 2D array you're gonna need later). When the test finishes I fill a table with the data and insert it at the bookmark using the "Append Table to Report" VI.



Remember Cunningham's Law
0 Kudos
Message 2 of 5
(2,984 Views)
Solution
Accepted by topic author davidthealias

There is a VI in the RGT called "Word Insert Row-Column-Cell".  Just call this function in a for loop as many times as needed and then add your data into the table using the "Word Edit Cell" function set to array data type.  Be sure to set the table index property for both functions. 

 

Capture.PNG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 5
(2,956 Views)

Hi David,

 

Did you find a solution to this? I am struggling with this problem as well.

 

bbell

0 Kudos
Message 4 of 5
(2,915 Views)

Yes aputman's solution above works very well. Sorry about the late reply and thanks to those above for the help

0 Kudos
Message 5 of 5
(2,881 Views)