Creating and Customizing Graphs in Microsoft Word Documents from LabVIEW

Publish Date: Oct 26, 2006 | 21 Ratings | 1.48 out of 5 |  PDF

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 Insert»Object»Microsoft 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

1. Creating and Using Word Templates

You can create custom report templates in Word to ensure a consistent appearance across multiple reports. Use templates to define page size, text formatting, and other aspects of report appearance. Complete the following steps to create a template in Word.
  1. Launch Microsoft Word.
  2. Select File»New and open the Templates dialog box.
  3. Select the Template option from the Create New section, as shown in the following dialog box.
  4. Click the OK button.



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.

Back to Top

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 Insert»Bookmark 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.

Back to Top

3. Comparison of Graph Properties Available in LabVIEW and Only in Word


You can customize several areas of a graph, including the chart type, axis, font, plot and chart area, chart options, and data series. You can customize some properties programmatically from LabVIEW, but you can customize some properties only in Word. The following table compares graph properties available from LabVIEW VIs and graph properties available only in Word. Refer to the Accessing Graph Properties Only in Word section for information about accessing the properties available only in Word.

Graph Properties Available from LabVIEW Graph Properties Available Only in Word
Axis
Word Set Graph Scale VI
  • Axis type
    • Category
    • Series Axis
    • Value
  • Axis Configuration
    • Autoscale
    • Min
    • Max
    • Scale Type
  • Linear
  • Logarithmic
Format Axis
  • Patterns
    • Major Tick Mark
    • Minor Tick Mark
    • Tick Mark Labels
  • Scale
    • Display Units
    • Value (Y) Axis Scale
    • Major Unit
    • Minor Unit
  • Alignment
    • Orientation
Fonts
Word Set Graph Font VI
  • Axis Font
    • Font Style
    • Bold/Italic
    • Underline
    • Size
    • Color
Format Plot and Chart Area
  • Font
    • Background
    • Effects
  • Strikethrough
  • Superscript
  • Subscript
Plot and Chart Area
Word Insert Graph VI
  • Graph Title (string)
  • Graph Size (cluster)
  • Row Headers
  • Column Headers
  • Measurement System
  • Has Legend

Word Set Graph Scale VI
  • Gridlines
    • Has Major Gridlines?
    • Has Minor Gridlines?
    • Major Gridlines Color?
    • Minor Gridlines Color?
Chart Options
  • Legend
  • Data Table

Format Legend
  • Patterns
  • Font
  • Placement

Format Data Series
  • Patterns
    • Line Style
    • Marker Color and Size
  • X and Y Error Bars
    • Display
    • 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

Back to Top

4. Accessing Graph Properties Only in Word


The following sections explain how to customize properties in Word.

Chart Type
To change the chart type, select the graph by double-clicking anywhere on the graph and then right-click the graph and select Chart Type. This examples uses the XY (Scatter) Plot with data points connected by smoothed lines.

Axis Properties
To format an axis, right-click the x- or y-axis and select Format Axis to open the Format Axis dialog box, as shown below.



Plot Properties
To format a plot, right-click the plot area and select Format Plot Area, as shown in the figure below.



Chart Area Properties
To format the chart area, right-click anywhere on the graph outside the plot area and select Format Chart Area, as shown in the figure below.



Data Series Properties
Right-click a plot and select Format Data Series to open the Format Data Series dialog box, shown in the figure below. Right-click a data point and select Format Data Series to access additional formatting options for that data point, including the x and y error bars.




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

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit