LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find and Replace String Characters in MS Office Parameters

Solved!
Go to solution

Hello,

 

I am using the Report Generation Toolkit to add various items to a test datasheet. I have assigned bookmarks to places where the values will be input to the datasheet. The issue that I am having is that it is very time consuming to go through and change each bookmark. I've tried using the Find and Replace feature but it doesn't seem to have the option to select all of the MS Office Parameters bundles and do a group replace. 

 

Is there a way to make this work?

0 Kudos
Message 1 of 9
(1,203 Views)

When you mention bookmarks, I assume you are talking about Word.  The DOCX format (and all other Office formats, i.e. XLSX, PPTX) is just a zipped file, which means you can change the file extension to .zip and view the file contents.  Within the ZIP file, in the 'word' folder, is a document.xml that contains all the content of your document.  Use the text function (search and replace, etc) to add your data. 

aputman
Message 2 of 9
(1,188 Views)

Thanks for the reply. I'm referring to the bookmarks in Labview, not not in the word template. 

0 Kudos
Message 3 of 9
(1,179 Views)

Are you trying to change the name of the bookmark in the code to match what is in the docx?  In what way are you trying to change the bookmark?  Technically, there are no bookmarks in LabVIEW, so the way you phrase your comments is confusing.  The bookmark is in the Word template and you reference the name of the bookmark in your code to insert text at that location.  Here is how to do that with the RGT:

aputman_1-1698082677764.png

 

Or you can use the method I described above to add text using the File I/O functions.

 

aputman
0 Kudos
Message 4 of 9
(1,157 Views)

Below are what I referred to as the MS Office Parameters "bundle". Part of this includes a place to specify a bookmark in the word document that you are appending. Say that I have a group of these with bookmarks such as, "C917_Pass_Fail32_1_1, C917_Pass_Fail32_1_2,...", and I would like to use find and replace to change the 32 in all of the designations to 18, is there a way to do that in Labview? 

 

 

 

Visual Example.png

 

 

0 Kudos
Message 5 of 9
(1,127 Views)
Solution
Accepted by topic author T_Black

The Find and Replace will do that.  Make sure the text option is selected.  Search for Fail32 and replace it with Fail18

aputman_0-1698093511588.png

 

aputman
0 Kudos
Message 6 of 9
(1,122 Views)

That did the trick. I wish it gave you the option to find and replace what is selected within a VI, but I just copied all of the ones that I wanted to change into a new VI and selected to change everything within that VI. Thanks for your help.

0 Kudos
Message 7 of 9
(1,113 Views)

@T_Black wrote:

Below are what I referred to as the MS Office Parameters "bundle". Part of this includes a place to specify a bookmark in the word document that you are appending.


Yes I know what the MS Office Parameters bundle is (there is only ONE in my code).  Again, please review my suggestion above about using arrays and for loops to build those clusters rather than creating 100 cluster constants and wiring them together on your block diagram.  You are obfuscating a large portion of the functionality of your code behind those cluster icons.  Imagine, in the future, trying to figure out what was in those clusters and what would be involved to debug your code or add another bookmark. 

 

aputman_0-1698094267259.png

 

aputman
0 Kudos
Message 8 of 9
(1,112 Views)

Nice trick. I didn't even think to unbundle and then bundle again (which seems obvious now).

0 Kudos
Message 9 of 9
(1,104 Views)