Jump to content

Report Generation Challenge


Recommended Posts

I would like to create a Word report with Labview which has some header information text (title, date etc.) and then about 200 pictures added on...with 16 pictures per page. The images are generated by my current code and dumped into a folder. I'm envisioning that there is something like New Report -> Add Title -> Add picture and then when stuck in a loop the images populate the report as they are being generated. Any suggestions?

Thanks!

Link to comment

Hey Brad,

I did this last summer for an RF lab. I rendered many graphs and tables into exactly the document you are referring to. However they wont let me release my work (even though no one uses it anymore... go figure). So here are the steps I took to getting along on this.

(1) Learn Word VBA and the Word Object Model <- Its super weird at first :)

*Here's a good book: http://oreilly.com/catalog/9781565927254/

(2) Get comfortable with ActiveX connections in LabVIEW. MS Word should already be visible on your machine.

(3) Program away! Its strictly a matter of how well you understand the word object model.

If you are comfortable with the LabVIEW environment and can pick up the Word Object model in a week or so, I estimate you can achieve your objectives within 1-3 weeks. While the learning curve for this is steep; it is only so for like 20 minutes :) . Very easy after that. I can post a 'hello world' example if you would like.If you have any more questions let me know.

Best of Luck,

Justin Reina

*And if you can afford the NI Office Toolkit, this is exactly what they did...

Link to comment

One useful suggestion in general for working with Office is to record what you want to do as a macro and then open the macro (to see how Word would do it) and replicate the macro code inside LabVIEW.

Another option is to try running the macro itself, but I haven't tried that.

Link to comment

You can certainly script your Macros with the ActiveX connection. This is a really efficient method to get up to speed on the word object model. I found it really hard though to get control of formatting and such however.

But most of my functionality started with tinkering with the macros.

-Justin

Link to comment

If you do write your own program to write to a word document, make sure it is a high performance box you run it on, because from my experience you may run into performance issues.......like the report generation portion of your program taking longer than the test itself (ahem..).

Link to comment

QUOTE (jasonh_ @ Apr 28 2009, 08:22 PM)

If you do write your own program to write to a word document, make sure it is a high performance box you run it on, because from my experience you may run into performance issues.......like the report generation portion of your program taking longer than the test itself (ahem..).

I don't have much experience with Word but I'm very well versed in Excel would recommend that you use this statement at the beginning of your macro:

Application.ScreenUpdating = False

Then turn the screen refreshes back on at the end of the macro

Application.ScreenUpdating = True

In Excel this can save you a good deal of time.

Charles Chickering

Link to comment

What about coding a HTML page and then opening and saving in WORD?

I have done this from TestStand. It was straightforward and I could get some nice looking reports.

I started with a html template/page where I embedded code with "dummy" tags; ex: "<will replace this HTML tag with tag for graph .gif">

ALSO What made this even better for me was LV HTML toolkit to put my array of results into a nice-looking HTML tables.

Let me know if you want to try this route and I can try to dig up some code.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.