This widget could not be displayed.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Generation MS Word Table Bug

Solved!
Go to solution

Hi everybody,

 

I am using Word 2010 and LV2010 and I am unable create a proper table with Word using the Report Generation Toolkit. Excel and HTML work fine, but Word fails. Not even the Examples work as they are supposed to.

When using the attached VI (see screenshot below)

 

 

the result appears as follows:

 

 

 

 

 

 

Temperature

Temperature

Temperature

Temperature

Temperature

Data 1

Data 1

Data 1

Data 1

Data 1

Data 2

Data 2

Data 2

Data 2

Data 2

Does anyone have an idea?

 

Thanks in advance.

 

ben

0 Kudos
Message 1 of 32
(5,230 Views)

Hi Ben,

 

I guess that problem is your system "list separator" sign. It looks that your code it is assumed be ";"(semicolon) but in your computer it is ","(comma). Try to change it from control panel and localization settings and run VIs again.

0 Kudos
Message 2 of 32
(5,227 Views)

Hi SnowForest,

 

thanks for the idea. Unfortunately it didn't work. The system setting is ";" and I have tried "," - no luck. Another idea?

 

ben

 

0 Kudos
Message 3 of 32
(5,221 Views)

Hi Ben,

 

Dis you change the settings for the ";" and the "," in the operating system or in Word?

If you have changed it in Word, die you restart Word? This necessary to adopt the changes.

 

If you did change the settings in the operating system please try changing them in Word.

The example code you posted works fine for Word 2007 on my PC so I wonder if there were some changes in Word 2010 regarding the conventions of ";" and ",".

I checked the Microsoft page regarding that but I couldn't see anything.

In this case I guess something is wrong with your settings.

 

I Hope This helps

 

Best Regards

 

Regina

National Instruments

AE Germany

0 Kudos
Message 4 of 32
(5,194 Views)

This is a known issue for the NI Report Toolkit creating tables in Word 2010.

There is no workaround unfortunately Smiley Sad.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 32
(5,189 Views)

OK, if NI won't provide a workaround, I'll create my own:

 

The problem stems from the fact that the NI Report Toolkit populate a Word table by first creating an empty table of the correct size, then placing the table contents into the copy buffer, then selects the whole table and uses Paste to push the data into the table. The problem is actually in Word, because in Word 2010 it interprets the contents of the copy buffer differently.

 

The solution is to alter the data that gets pushed into the copy buffer by the NI Report Toolkit. To implement my fix, you will need to alter one VI of the NI Report Toolkit (so you might want to make a backup in case this stops it from working in other previous release of Word).

 

Open [LabVIEW installation folder]\vi.lib\addons\_office\_wordsub.llb\Word_Insert_Table.vi

There is a nested for loop that interprets the provided string array data and reformats it into a long ASCII string for the copy buffer. It should look like this:

NIreporttoolkitorig.jpg

 

Change the nested loop to look like this:

NIreporttoolkitnew.jpg

 

The changes I've made are twofold:

1. Within the inner loop, replace the "\n" char with a Tab character

2. Just after the inner loop, add a new "concatenate strings" function that adds "\n".

 

This alters the string that the toolkit places into the copy buffer. You should find that report tables now populate correctly in Word 2010!

 

This is untested on previous releases of Word, and could possible introduce problems there, so if anyone could test this for me it would be most appreciated Smiley Tongue

 

Best of luck!

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 6 of 32
(5,185 Views)

Hi Thoric,

 

I expected something like this, but I didn't have the time to dig that deep. It sounds good. Nevertheless, after applying your changes the result looks like this:

 

 

Temperature

Data 1

Data 2

Data 3

 

Temperature

Data 1

Data 2

Data 3

 

Temperature

Data 1

Data 2

Data 3

 

Temperature

Data 1

Data 2

Data 3

Better but not quite it. Thank you anyway.

 

ben

0 Kudos
Message 7 of 32
(5,168 Views)

Hi ben,

 

How odd, that's what my tables look like in Word 2010 before I implement my fix. I didn't use your example to check my fix, only my own implementation of NI Report tables, so I'll try this with your attached VI and see what I can discover...

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 8 of 32
(5,166 Views)

Actually, it works fine for me. Without my fix, the table looks like:

new-1.jpg

 

and after my fix it looks like:

new-2.jpg

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 9 of 32
(5,165 Views)

P.S. My localisation settings > list separator symbol is a comma ","

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 10 of 32
(5,157 Views)