06-20-2011 04:40 AM
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
Solved! Go to Solution.
06-20-2011 05:00 AM
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.
06-20-2011 05:29 AM
Hi SnowForest,
thanks for the idea. Unfortunately it didn't work. The system setting is ";" and I have tried "," - no luck. Another idea?
ben
06-28-2011 09:41 AM
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
06-28-2011 10:43 AM
This is a known issue for the NI Report Toolkit creating tables in Word 2010.
There is no workaround unfortunately .
06-28-2011 11:00 AM
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:
Change the nested loop to look like this:
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
Best of luck!
06-29-2011 03:08 AM
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
06-29-2011 03:10 AM
06-29-2011 03:15 AM
06-29-2011 03:53 AM