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:
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 ReportA 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 dialogEasy Text ReportAnother 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.
Advanced Report GenerationFor 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:
Creating and Closing ReportsNew 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 ReportsSave 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 ReportsPrint 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 StylesSet 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 ContentAppend 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 PaletteThe 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 PaletteThe 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 PaletteThe Advanced Report Generation palette (see Figure 16.75) contains various advanced report generation functions. Figure 16.75. Advanced Report Generation palette |