Creating and Customizing Graphs in Word From LabVIEW
Creating and Customizing Graphs in Word From LabVIEW
Creating and Customizing Graphs in Word From LabVIEW
Overview
The LabVIEW Report Generation Toolkit for Microsoft Office includes VIs to create and customize graphs in Microsoft Word from LabVIEW. With the Word Insert Graph VI, you can
programmatically insert and populate a graph in a Word document, and you can customize the graph with the Word Graphs and Pictures VIs.
Note The LabVIEW Report Generation Toolkit VIs do not offer access to all exposed ActiveX properties and methods for graphs available in Word. If you need to customize graphs beyond the
options in the LabVIEW Report Generation Toolkit VIs, create a Word template, insert a graph, and customize the graph manually in Word. To insert a graph in a Word template, select
InsertObjectMicrosoft Graph Chart. Then use the Word Update Graph VI to populate the customized graph with data from LabVIEW.
This document explains how to create and use Word templates, use bookmarks, and access the graph properties from LabVIEW and Word.
Table of Contents
1. Creating and Using Word Templates
2. Using Bookmarks
3. Comparison of Graph Properties Available in LabVIEW and Only in Word
4. Accessing Graph Properties Only in Word
The template looks exactly like a Word document, but it has .dot extension instead of a .doc extension. You now can add standard elements to the report template, including a company header
and the report date. You also need to identify where in the document you want LabVIEW to insert the graph, which is described in the next section.
2. Using Bookmarks
A bookmark in a Word document or template marks a specific location in that document. In this example, you use a bookmark to identify the location of the graph you will insert from LabVIEW.
Complete the following steps to define a bookmark in your Word template.
1. Place the cursor in your Word template where you want the new bookmark to be. This location is where LabVIEW will insert the graph.
2. Select InsertBookmark to open the Bookmark dialog box.
3. Enter a bookmark name (for this example, Graph) and click the Add button.
Note Bookmark names cannot contain spaces or any special characters.
4. In LabVIEW, use the Word Insert Graph VI to insert a new graph in the current template. Use the bookmark name input to specify where LabVIEW should insert the graph in the Word
template. This VI supports all the graph types provided by Microsoft Graph.
5. Use the following VIs to modify the scale and to change color and font attributes: Word Set Graph Scale VI, Word Set Graph Colors VI, and Word Set Graph Font VI. Use the Word Format
Picture VI to set the graph size or color.
Refer to the LabVIEW Help for information about the Report Generation VIs.
1/4
www.ni.com
Axis
Word Set Graph Scale VI
Axis type
Category
Format Axis
Patterns
Major Tick Mark
Series Axis
Value
Axis Configuration
Autoscale
Scale
Display Units
Min
Max
Major Unit
Scale Type
Minor Unit
Linear
Alignment
Orientation
Logarithmic
Fonts
Word Set Graph Font VI
Axis Font
Font Style
Bold/Italic
Effects
Underline
Strikethrough
Size
Superscript
Color
Subscript
Chart Options
Legend
Data Table
Row Headers
Format Legend
Patterns
Column Headers
Measurement System
Font
Has Legend
Placement
Word Set Graph Scale VI
Gridlines
Has Major Gridlines?
Error Amount
Shape
Data Labels
Options
Gap Depth
Gap Width
Chart Depth
Format Plot or Chart Area
Patterns
Border
Fill Effects
Gradient
Texture
Pattern
Picture
2/4
www.ni.com
Plot Properties
To format a plot, right-click the plot area and select Format Plot Area, as shown in the figure below.
3/4
www.ni.com
Legend Properties
Right-click a legend and select Format Legend to set legend properties.
Related Links:
LabVIEW Report Generation Toolkit for Microsoft Office User Guide
4/4
www.ni.com