Report Generation


Whether it is for your boss, your customer, or for taping to your refrigerator to show your family, there are a lot of good reasons to create a report. LabVIEW provides several VIs on the Programming>>Report Generation palette (shown in Figure 16.58) that allow you to generate reports and either save them or send them to a printer to make a hard copy.

Figure 16.58. Report Generation palette


The report generation VIs allow you to create reports in one of two formats:

  • HTML file (that can be viewed in a web browser)

  • RTF file (rich text format, which can be viewed and printed by any word processing application and most text editors)

You will need to specify which report format you want, when you create it.

National Instruments also sells a LabVIEW Report Generation Toolkit for Microsoft Office. This provides VIs for programmatically creating and editing Microsoft Word and Excel reports from LabVIEW. This can come in very handy if your pointy-haired boss demands that all TPS reports be in a Microsoft Word format.


Express Report

A fast and easy way to generate a report from your measurement data is to use the Report Express VI, along with its configuration dialog (see Figure 16.59). This allows you to enter the report header information, configure whether to add graphs or tables of the measurement data, and specify the type of report (Destination).

Figure 16.59. The Report express VI along side its configuration dialog


Easy Text Report

Another quick way to create a report is by using Easy Text Report.

Figure 16.60. Easy Text Report


Easy Text Report (Programming>>Report Generation palette) allows you to pass in a block of text along with optional formatting information and print the report to a designated printer. Use tokens with this VI to generate information in the report, such as in the headers and footers. For example, you can insert a time stamp in the footers of the report. You cannot use tokens with Word and Excel reports.

The following list describes the tokens available when using Easy Text Report.

Token

Description

<tab>

For standard reports, LabVIEW indents the text to the next tab location. For HTML reports, LabVIEW interprets this token as <br>.

<page>

Current page number. LabVIEW ignores this token for HTML reports.

<pages>

Total number of pages. LabVIEW ignores this token for HTML reports.

<pagenofm>

Current page number with the total number of pages in the report. LabVIEW ignores this token for HTML reports.

Example: 7 of 30

<shortdate>

Current date in the form xx/xx/xx.

Example: 10/5/98

<longdate>

Current date in the form Day, Month and Date, Year. The month, date, and year order defaults to the date settings of your operating system.

Example: Monday, October 05, 1998

<time>

Current time in the form Hour:Minute:Second AM/PM.

Defaults to the clock settings of your computer.

Example: 1:58:22 PM

<newline>

Inserts a line break in the report.


Advanced Report Generation

For more advanced report generation, you will start out by calling New Report, which outputs a report reference that can be used with the other advanced report generation VIs. You will need to specify the report type (Standard or HTML) when you call New Report.

The sequence of operations for using the advanced report generation VIs is to:

1.

Call New Report to create a new report, specifying the report type.

2.

Call Set Report Font and the Report Layout palette VIs to configure the report styles.

3.

Call the various Append . . . to Report VIs to add content to the report.

4.

Call Print Report or Save Report to File.

5.

Call Dispose Report to close the report.

Creating and Closing Reports

New Report (Programming>>Report Generation palette) creates a new report (see Figure 16.61). You must use this VI to create a report if you do not use the Easy Text Report VI.

Figure 16.61. New Report


Dispose Report (Programming>>Report Generation palette) closes the report and releases its interface, which saves memory. After the VI runs, you cannot perform further operations on the report. The Dispose Report VI should be the last VI you use when you create a report (see Figure 16.62).

Figure 16.62. Dispose Report


Saving Reports

Save Report to File (Programming>>Report Generation palette) saves an HTML report to the file specified in report file path. You cannot use this VI with standard reports (see Figure 16.63).

Figure 16.63. Save Report to File


Printing Reports

Print Report (Programming>>Report Generation palette) prints a report to a designated printer or to the default printer on the computer (see Figure 16.64).

Figure 16.64. Print Report


Set Report Orientation (Programming>>Report Generation>>Report Layout palette) determines whether the report is printed in landscape or portrait orientation (see Figure 16.65). You cannot use this VI with HTML reports. Use this VI prior to printing the report to ensure the correct orientation.

Figure 16.65. Set Report Orientation


Report Styles

Set Report Font (Programming>>Report Generation palette) sets the font properties of the report, including those in the headers and footers (see Figure 16.66). The available properties include italic, bold, strikethrough, underline, color, font name, font size, character set, and weight. The font you specify in the VI becomes the default font for the report.

Figure 16.66. Set Report Font


Adding Report Content

Append Report Text (Programming>>Report Generation palette) appends text to the selected report. The input into text must be a string. The selected report is the one passed into report in. You can append the text to the current position of the cursor in the report or on a new line (see Figure 16.67).

Figure 16.67. Append Report Text


Append Image to Report (Programming>>Report Generation palette) For an HTML report, the VI embeds a link to an image into the report. For a standard report, the VI appends the image from a file (see Figure 16.68). Standard reports support .bmp, .gif, .wmf, .emf, and .jpg image files, but not .png files.

Figure 16.68. Append Image to Report


Append List to Report (Programming>>Report Generation palette) Adds a list of elements to the report. If you select ordered, the list is numbered or lettered. If you select unordered, the list is formatted with an item indicator or dash (see Figure 16.69).

Figure 16.69. Append List to Report


Append Table to Report (Programming>>Report Generation palette) Appends a 2D array to a report as a table with the given column width. The data type you wire to the text data input determines the polymorphic instance to use (see Figure 16.70).

Figure 16.70. Append Table to Report


Append Control Image to Report (Programming>>Report Generation palette) Creates an image of the front panel object specified in Ctrl Reference and appends it to a report (see Figure 16.71). For an HTML report, the VI saves the image file to the temporary directory and adds a link to the image file in the report. For a standard report, the VI appends the image to the report.

Figure 16.71. Append Control Image to Report


Append Front Panel Image to Report (Programming>>Report Generation palette) Creates an image of the front panel of the VI you specify in VI and appends it to a report (see Figure 16.72). The data type you wire to the VI input determines the polymorphic instance to use. The VI also includes an instance whose connector pane is compatible with versions of the VI in LabVIEW 6.1 and earlier.

Figure 16.72. Append Front Panel Image to Report


Report Layout Palette

The Report Layout palette (see Figure 16.73) contains various VIs for configuring the layout of your report.

Figure 16.73. Report Layout palette


HTML Reports Palette

The HTML Reports palette (see Figure 16.74) contains various VIs specific to generating HTML reports.

Figure 16.74. HTML Reports Only palette


Advanced Report Generation Palette

The Advanced Report Generation palette (see Figure 16.75) contains various advanced report generation functions.

Figure 16.75. Advanced Report Generation palette





LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net