bradjb911 Posted April 28, 2009 Report Share Posted April 28, 2009 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! Quote Link to comment
Francois Normandin Posted April 28, 2009 Report Share Posted April 28, 2009 QUOTE (bradjb911 @ Apr 27 2009, 05:48 PM) 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! Well, there's a http://sine.ni.com/nips/cds/view/p/lang/en/nid/5769' target="_blank">Report Generation Toolkit from NI. Or if you want a challenge, you could participate in this... Quote Link to comment
Justin Reina Posted April 29, 2009 Report Share Posted April 29, 2009 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... Quote Link to comment
Yair Posted April 29, 2009 Report Share Posted April 29, 2009 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. Quote Link to comment
Justin Reina Posted April 29, 2009 Report Share Posted April 29, 2009 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 Quote Link to comment
Jason H Posted April 30, 2009 Report Share Posted April 30, 2009 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..). Quote Link to comment
Charles Chickering Posted April 30, 2009 Report Share Posted April 30, 2009 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 Quote Link to comment
Justin Reina Posted April 30, 2009 Report Share Posted April 30, 2009 Yes indeed! My docs were repaginating after every picture insert, and after 100 pages or the system absolutely came to its knees (Word). -Justin Quote Link to comment
pete_dunham Posted April 30, 2009 Report Share Posted April 30, 2009 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.