LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fill data into a form programmatically and print the form afterwards

Folks,
 
until recently a lab assistant took measurements and filled the data into a paper form (see attached pdf). Now we are building a test stand that does the measurement semiautomatically. The software of the test stand will be programmed in LabVIEW, of course. The test stand shall generate a printed protocol very similar to the attached pdf in future as well.
 
What's the best way to fill the acquired data into the form and to print the form afterwards? The form can be read by our code in either pdf or html. There is no Microsoft Office installed on the computer.
 
Modifying the html code? Converting the pdf to a picture and fill the data into the picture? Any hint will be highly appreciated.
 
Thanks,
Peter
0 Kudos
Message 1 of 7
(4,705 Views)
There's a few ways you could do this, and I'm sure others will suggest additional options.
  • Have you looked at the Report Generation set of VIs that ship with LabVIEW? These do not require Office.
  • You could save the data as XML and then have an XSL with which to create an HTML report that you can print. This will allow you to modify the format of the format outside of LabVIEW.
  • You could have LabVIEW simply generate the report as HTML in the first place.


Message Edited by smercurio_fc on 01-15-2008 08:41 AM
0 Kudos
Message 2 of 7
(4,700 Views)

Smercurio,

thanks.

Point 1: Yes, we looked at the Report Generation Toolkit but it doesn't offer what we are looking for. We don't want to generate a new report but rather utilize the template that is provided by our customer. As I wrote this template is available in either *.doc, *.html or *.pdf.

Point 2:  Sounds interesting but doesn't really tell me much. I've heard about XML but never about XSL and it'll probably take me weeks until it works. Any tutorial around that comes close to our task?

Point 3: Seems to be the same as or at least very similar to point 1.

Any other suggestions?

Peter

0 Kudos
Message 3 of 7
(4,686 Views)
Given your options of not having Office installed, and that you want the form to look like the customer's template, then I would use HTML format. HTML is just a formatted text file, so that would be the easiest way to go.

When you capture your data using LabVIEW, save it as text. You can either have the main VI save the data to the HTML file automatically, or create a small VI to convert the data after the testing is done. Inserting or replacing text is very easy in LabVIEW. Then, you can view the data from LabVIEW or any web browser, and save it to PDF or print it out or whatever.

B-)
0 Kudos
Message 4 of 7
(4,677 Views)
Hmmm... must have misunderstood what you were saying.

XSL is a language that allows you to generate an HTML document. The XSL basically defines the style, and the XML specifies the data. HTML is the combination. You can find out more here.

Unfortunately, since you don't have Office, you won't be able to use the ActiveX interface to control Word, so that's out.

With the template in HTML format you could use the DOM for an HTML file to set the value of the HTML elements. The easiest way to do this is to use IE (I'm assuming you're on Windows here) to open the HTML template and then you can use the DOM from there. As for how feasible this is, it would depend on your HTML format. Can you post the template in HTML format?

With the template in PDF format I know that some PDF files that are forms can be generated in such a way that they still act like forms when you open them in, say, Acrobat Reader. Acrobat has an ActiveX interface so you should be able to programmatically do this, but I can't say for sure. You can check the Adobe site for more info. You just need to make sure it doesn't require the full version of Acrobat.
0 Kudos
Message 5 of 7
(4,673 Views)
I agree with smercurio, in that there are many more elemennts and functions in XSL to do what you need. However, since I learned HTML back in the old days (pre-WYSIWYG editors!) it would take me a day or two to catch up. Smiley Wink

If your template does not change, then a simple search-and-replace strings VI would do the trick.
0 Kudos
Message 6 of 7
(4,665 Views)

Hi Smercurio, hi LabVIEWGuru,

thank you both for your very valuable comments. Indeed I solved the problem yesterday tonight by simply searching and replacing marker strings in the HTML template with the string-formatted data.

Just to make the discussion complete, I attach a typical template in HTML format, Smercurio. Only by your comment I got into touch the first time with DOM and XSL. Seems to be a fascinating field but right now I simply don't have the time to dive into it deeper.

Thanks once again. Till next time.

Peter

P. S.: NI doesn't accept HTML files to be posted. I rename the file to *.txt and try once again.

0 Kudos
Message 7 of 7
(4,656 Views)