10-28-2008 03:02 PM
I would like to create a ms word report generator function in my lb8.2 project.
in the report, i need to paste or insert a gif file and a table from either the lv table or from .csv file.
i dont know where to start, the project that i have is done except for the report generator function.
my opinion is to write a vb6.0 program and shell it in lv8.2. I dont know if lv8.2 has a shell function to run external executable file from with in lv application.
and also how can i change the focus back to labview after the shell program is finished.
i need your ideas on this.
Solved! Go to Solution.
10-28-2008 03:33 PM
An easy solution would be the Report Generation Toolkit if you have it. It's not very difficult to throw together a Word file in there, and there are examples that can help get you started.
If you don't have access to the toolkit, I can't give you a direct answer, but I can point you in the right direction. Perhaps someone else has called Word successfully? I've never run across a LabVIEW Word file generator that I liked or have gotten to work properly - only short examples that didn't really help me much. However, for the last few years I've personally had great luck generating Excel reports using this rather old toolkit. Some of the calls to methods and properties have changed with newer versions of Excel, but it's usually not that hard to figure out, and hey, it's free. I've never imported a picture, but there's almost definitely a way to do it using .NET or ActiveX. If you're already pretty familiar with .NET and ActiveX in other languages, you might want to try your hand at trying to figure out which methods to call for Word or Excel. To see how this works in LabVIEW, check under Help->Find Examples, and type in ActiveX or .NET. That should get you started...
Finally, If you get stuck, probably the simplest way to call anything external is by using the "System Exec" VI. I don't remember where it was in LabVIEW 8.2 (I used to!), but in 8.6 it's under the connectivity pallete. (Search the palletes if you get stuck) With that VI you can call anything as if you were at the command prompt. As long as the "Wait until completion" input is set to true, LabVIEW should come back into focus when whatever you've executed completes. You could probably call you VB app via .NET, too.
Just a few ideas... I hope they help.
Jim
10-29-2008 11:17 AM
thanks Jim for the information.
I will try the excel toolkit.
Thanks for the hint on the 'system exec' function in labview. By the way, do you have example for the system exec inputs?
regards,
10-29-2008 11:27 AM
As I said before, that Excel toolkit's old and I haven't used it in a while, but I know it worked with some very minor tweaking on Office XP. The tweaking is usually due to Microsoft renaming methods and properties to something slightly different, but it's usually pretty apparent.
As far as a System Exec example, I found the attached example included with LabVIEW 8.6. It's listed under the "most recent" category, so I'm wondering if it wasn't included with 8.2. In any case, here it is, saved backwards to 8.2... (I only have 8.5.1 and 8.6 installed right now)
Jim
10-29-2008 03:37 PM
thanks Jim
I got it working.