Integrating Visio 2007: Introduction to Integrating Visio with Other Microsoft Programs
Summary: Microsoft Office Visio 2007 provides enhanced data integration capabilities and improved tools for users who want to link their data to their diagrams. (16 printed pages)
Applies to: 2007 Microsoft Office Suites, Microsoft Office Visio 2007
With Microsoft Office Visio 2007, you can more easily integrate diagrams and data from a variety of data sources by using the Visio Data Selector Wizard. This wizard enables you to connect to Microsoft Office Excel 2007, Microsoft Office Access 2007, Microsoft SQL Server databases, SQL Analysis Services, and other data sources. Office Visio 2007 can also automatically refresh linked data in diagrams; this reduces manual data re-entry and makes it easier to handle data conflicts that might arise with data changes.
You can take advantage of these new data-linking features in Visio if you store data in one of the forms accessible by using the Data Selector Wizard.
Integrating Visio 2007 with Other Microsoft Tools
For more information about integrating Visio with other Microsoft tools for developers, see the following resources.
Visio 2007 and Excel 2007
By clicking Reports on the Visio Data menu, you can capture data from Office Visio 2007 into a report in Office Excel 2007. You can extract Shape Data and other information from the shapes in a Visio drawing and organize and format the data into the report. Reports is a powerful tool, but sometimes you want more control of the report that is generated. You can create custom reports by using Automation. For more information about both techniques, see the article Integrating Visio 2007 and Excel 2007.
Visio 2007 and Access 2007
You can bring data that is stored in an Access database into the Visio External Data window by using the Data Selector Wizard. You can also use Automation code to establish a custom connection between Access and Visio. For more details and an example of this technique, see the article Integrating Visio 2007 and Access 2007.
Visio 2007 and Project 2007
Visio 2007 and Project 2007 include many features to help make sharing data between these applications easy. For more information about how to integrate Visio and Project, see the article Integrating Visio 2007 and Project 2007.
Visio 2007 and SharePoint Products and Technologies
Microsoft Windows SharePoint Services 3.0 provides information-sharing tools, robust storage, and a collaboration infrastructure. You can use Windows SharePoint Services to manage Visio documents, and you can display and link to SharePoint lists from the Visio External Data window. To learn more about managing Visio data and displaying SharePoint lists in Visio diagrams, see the article Integrating Visio 2007 and SharePoint Products and Technologies.
Visio 2007 and Active Directory
The article Integrating Visio 2007 and Active Directory discusses several ways to integrate Visio 2007 with Active Directory, to create data-driven diagrams that can update data directly in Active Directory.
Visio 2007, MOM, Exchange, and Reporting Services
The article Integrating Visio 2007 and MOM, Exchange, and Reporting Services describes both the native integration among Microsoft Operations Manager 2005 (MOM), Microsoft Exchange 2003, and Visio and some additional ways that you can integrate applications by using Visio Automation.
Visio 2007 and Microsoft SQL Server
The article Integrating Visio 2007 and Microsoft SQL Server 2005 illustrates several ways that you can interact with Microsoft SQL Server data. You can create data-driven diagrams from data stored as SQL data and create PivotDiagrams from SQL Analysis Services.
Bringing Data into Visio from Other Sources
Visio 2007 includes more data-integration capabilities than previous versions of Visio. Previous versions typically provided a snapshot of data at a given time. Visio 2007 acts as a window into your data, enabling you to more easily manage and update your data—whether you choose to do so from the data source or through the Visio user interface (UI).
Visio 2007 enables you to be more productive by integrating diagrams with information across sources. You can integrate data with diagrams to combine visual, numeric, and text-based information, which provides a visual context for the data and creates a complete picture of your system or process.
Visio 2007 enables you to quickly import and display data directly on your shapes. The first step is to connect to the data source and import data into your drawing. The second step is to link the imported data to shapes.
Importing Data into Visio by Using the Data Selector Wizard
The first step in linking data to a Visio diagram is to use the Data Selector Wizard to import data from the data source into the new External Data window in Visio 2007. Start with a Visio diagram, similar to Figure 1.
Figure 1. Visio network diagram, before importing data into drawing file
To link data to a Visio diagram, on the Data menu, click Link Data to Shapes.
On the first page of the Data Selector Wizard, choose the type of data source you want to use. For this example, select Microsoft Excel Workbook, and then click Next.
Figure 2. Choose the type of Data Source you want to import
Browse to the .xls file you want to import, and then click Next.
Figure 3. Select the file you want to import
Choose the worksheet you want to import, and then click Next.
Figure 4. Choose the worksheet you want to import
On the Connect to Data page, you can choose to include all columns and rows in your data source or you can specify individual columns and rows to be included.
Figure 5. Choose to include all columns and rows or specific columns and rows
Click Next to move to the Configure Refresh Unique Identifier page of the Data Selector Wizard. Visio attempts to detect a column of data that you can use to identify each row of data and presents the data as the recommended selection. If this data does not uniquely identify each row of data, you can choose some other data element or combination of data elements. Click Next to move to the final screen of the wizard.
Figure 6. The Configure Refresh Unique Identifier page
On the final screen of the wizard, click Finish. The imported data is displayed in the External Data window.
Figure 7. The External Data window shows the information that you imported into the Visio 2007 file
The data you see in the External Data window is a snapshot of the data at the time of the import. At this point, you can update the data in your drawing to match the data in your source file. However, because the data and shapes are not yet linked, you cannot refresh your data source by making changes to the data in the drawing.
Linking Data to Drawing Elements
After you import data into the Visio file, the next step is to link the data to the Visio drawing elements. There are three ways to link data to the shapes in your Visio drawing:
You can drag a row from the External Data window onto a shape in the drawing to link that data row with a specific shape. After the shape is linked to the data, the data is displayed on the shape. You can modify the data that is visible on the shape by using the Edit Data Graphics command, on the Edit menu.
You can link a single row to multiple shapes but you cannot link multiple rows to one shape.
Figure 8. Drag a row from the External Data window onto a shape to link the shape to the data
You can link rows to existing shapes automatically. This is a good approach if you have a drawing with a large number of shapes. To link the data to shapes automatically, you must have data already defined for a shape that corresponds to data in your external data file. For example, if you have a network drawing that has all the shapes labeled with their IP addresses, and your data set also contains IP addresses, you can use the IP address to automatically link the rows to the appropriate equipment. To do this:
On the Data menu, click Automatically Link.
Follow the steps in the wizard and specify which field in your data source identifies the correct data elements in your diagram.
Finally, you can create shapes from your data. This approach works best if you have a data source, and you know what kind of diagram you want to create, but you do not yet have shapes in your drawing. To do this:
Create a drawing.
In the Shapes window, click a shape.
Drag a row from the External Data window onto the drawing page. The row is then associated with the type of shape you have selected in the Shapes window.
Continue to drag rows onto the drawing. One instance of the shape appears for each row you drag into the drawing.
Select a different shape and drag another row, to associate data with a different type of shape.
After you link your data to the Visio diagram, you do not need to worry about manually updating your Visio drawing. You can easily refresh the data in your diagrams by using the Data Refresh feature.
Figure 9. Right-click in the External Data window, and then click Refresh Data
You can also schedule Visio 2007 to automatically refresh the data in a diagram at fixed intervals. To do this:
On the Data menu (or from the shortcut menu), click Configure Refresh.
In the Configure Refresh dialog box, under Automatic Refresh, select the Refresh every check box and type the value you want for the length of the refresh time interval.
Figure 10. The Configure Refresh dialog box
You can easily analyze your information and gain insight by displaying the linked data in your diagrams. You can display data in your shapes in a variety of ways by using the data graphics tools in Visio 2007.
Generating an Excel Bill of Materials from Data Stored in Shapes by Using the Reports Tool
From within Visio 2007, you can create reports that present your data in a variety of ways. One example is reporting data from Visio 2007 to Office Excel 2007. If you create a drawing and you add data to the shape or to your Shape Data fields, you can generate an Excel 2007 report summarizing that data. In Figure 11, data has been associated with the equipment shapes in the diagram by using Shape Data fields, and it is displayed by using data graphics.
Figure 11. A network diagram with associated Shape Data
To report on the data contained in the diagram
On the Data menu, click Reports.
In the Reports dialog box, choose the report to run. You can modify an existing report or you can create and save a new report.
Figure 12. The Reports dialog box enables you to run or modify existing reports or to create a report
By selecting Modify or New, you can choose the fields on which you want to report.
In the Report Definition Wizard, choose which shapes you want to include in your report: Shapes on all pages, Shapes on the current page, or Selected shapes.
Figure 13. Specify which shapes are in your report
On the next page of the Report Definition Wizard, specify which fields you want to export to your Excel 2007 report.
On the next page, type a title for your report and indicate how you want the data sorted and formatted.
Run the report. Select Excel as the reporting format.
Figure 14. Data reported to Excel from the Visio 2007 network diagram
PivotDiagrams: Analyzing Data By Using Different Views
Visio 2007 enables you to easily track trends, identify potential problem areas, and flag exceptions by using PivotDiagrams.
PivotDiagrams, new in Visio 2007, give you the power to visualize business data in a variety of ways. PivotDiagrams show data as a collection of shapes arranged in a tree-like structure that helps you to analyze and summarize data in a visual, easy-to-understand format. By using PivotDiagrams, you can visually explore your business data, analyze it, and create multiple views of it to gain deeper insight into the information.
You can also apply conditional formatting to track trends, identify potential problem areas, and flag exceptions. PivotDiagrams are a graphical representation of the same kinds of information you might view in a pivot table. For example, you might show variable data as progress bars, demonstrate data that increases or decreases with arrows or speedometers, and indicate incomplete or problem data by displaying a large red X. You can insert a PivotDiagram into any other Visio diagram to provide a complementary view of the data.
To create a PivotDiagram, open the PivotDiagram template; the Data Selector Wizard starts immediately. From another drawing type, on the Insert Data menu, you can also select Insert PivotDiagram. The wizard guides you through each step of connecting the diagram to a data source, and then creates what is called a "pivot node," which is linked to all of the data in the data source. You can expand the pivot node to show various levels that correspond to the data that you want to analyze.
You can use PivotDiagrams to view data in a variety of ways. In Figure 14, the data is first categorized by Administrator and then by IP Address. In Figure 15, notice that:
The Count field, Memory field, and CPU field are numeric categories and can be accumulated at each level.
You can associate shapes with the pivot nodes to better illustrate each level. In this example, a person shape is associated with the node at the Administrator level and a computer shape is associated with each node at the IP Address level.
You can apply data graphics to make the information in the diagram stand out more distinctly. A data graphic has been applied for the amount of memory in each computer. If the computer has at least 1 MB of memory, the data graphic shows a green check mark. If the computer has less than 1 MB of memory, the data graphic shows a red X.
Figure 15. PivotDiagram showing inventory of network equipment
Categories, Levels, and Nodes
To understand categories, levels, and nodes, think of each element in the context of your data source:
Notice that each column of your data source is either non-numeric or numeric.
Think of the non-numeric columns as categories—for example, Manufacturer, Administrator, or IP Address. Any of these can become a level under the top node.
The values under a column like IP Address might be numbers, but they are not numbers that can be totaled or otherwise summarized.
Think of the numeric columns as data, such as numbers or currency, that can be summed or averaged, or that have minimum or maximum values.
Think of each node as a group of rows from your data source that have a common value in a specified column. For example, for the category Administrator, all the rows with "Don Hall" would be grouped into a single node.
You can use the following data sources to create a PivotDiagram:
Microsoft Office Excel workbooks
Microsoft Office Access databases
Microsoft Office SharePoint lists
Microsoft SQL Server databases
Microsoft SQL Server Analysis Services
Other OLE databases or Open Database Connectivity (ODBC) data sources
Figure 16. A PivotDiagram demonstrating recruiting information by Status
The Visio Viewer and Previewing Drawings in Outlook 2007
The Visio 2007 Viewer enables anyone to view Visio 2007 drawings and diagrams inside their Internet Explorer (Microsoft Internet Explorer 5, Microsoft Internet Explorer 6, or Windows Internet Explorer 7) Web browser, or to preview drawings inside Microsoft Office Outlook 2007.
Visio users can freely distribute Visio drawings and diagrams to team members, partners, customers, or others, even if the recipients do not have Visio installed on their computers. The Visio 2007 Viewer enables users to discover the advantages of using Visio drawings, charts, and illustrations in a Web-based environment. It is particularly useful for teams that need to collaborate from different locations when not all team members have access to the full functionality of Visio 2007.
Viewing a Visio drawing is simple: double-click the drawing (a file with a .vsd, .vss, .vst, .vdx, .vsx, or .vtx extension) in Windows Explorer. Internet Explorer opens, and the Visio 2007 Viewer renders the drawing in the browser window. You can then pan and zoom in the drawing window by using toolbar buttons, keyboard shortcuts, or menu items in the shortcut menu. Also, you can see properties on any shape by opening the Properties and Settings dialog box and then selecting a shape. Some rendering and display settings are available on the Display Settings tab of the Properties and Settings dialog box. You can also set drawing-layer visibility and colors on the Layer Settings tab, and you can set annotation visibility and colors on the Markup Settings tab.
Users who have not explicitly downloaded and installed the Visio 2007 Viewer but who are running Office Outlook 2007 can preview Visio Drawings in the Outlook environment.
Save As Web Page
You can create one type of export by clicking Save as Web Page on the File menu. This export varies from other export options in several ways.
When you use Save as Web Page, Visio:
Creates a composite HTML file with many supporting files.
Generates .vml, .gif, .jpg, and/or .png files.
Can convert a multiple-page drawing with navigation into a Web page or Web pages.
Creates a Web page where you can see Shape Data.
Creates a Web page that includes functioning hyperlinks to the additional Web pages, if more than one Web page is generated.
Although the file name extension listed is *.htm, *.html, there are several files generated with this export, not only one HTML file. By default, the export creates a folder with a name matching the HTML file. The folder contains all of the supporting files referenced by the HTML file, and the HTML file references the other generated files. The Save as Web Page export is actually a complex solution involving several dialog boxes and input options, and it generates many files as output.
This export uses other filters when generating its output. Because an HTML file is not a graphics file, the image from your Visio drawing must be saved in a graphics file format that can then be displayed on the new Web page. The types of graphics files that the Save as Web Page solution can use include the common raster formats used on the Web: GIF, JPG, PNG, and a vector Web format called VML. By default, if you are using Internet Explorer 5, Internet Explorer 6, or Windows Internet Explorer 7, the output formats are VML and GIF. GIF is used so that your generated Web page is compatible with older browsers. Effectively, a dynamic Web page and multiple graphics files are exported.
Settings from the graphics filters for GIF, JPG, and PNG formats are shared with the normal exports for GIF, JPG, and PNG files.
This export works on multiple-page documents; many other export options work on only one page at a time. You can add navigation to the generated HTML pages automatically to enable users to move between exported pages.
This export uses XML and some advanced features of Web browsers to expose Visio drawing data and hyperlink information in the HTML output files. When you pause your mouse over a shape in the Web browser, you can now view data that you add to shapes as Shape Data. You can also access multiple hyperlinks for each shape from the Web browser. Clicking a shape that has multiple hyperlinks brings up a list of the hyperlinks for the shape so that you can select one. (In older browsers only one hyperlink, the one set as the default, is visible.)
Choosing Save As on the File menu and then selecting Web Page from the Save as Type list box is the same as selecting Save as Web Page on the File menu. In each case, the Save As dialog box appears and the Publish button is added in the bottom-right section of the dialog box.
Figure 17. Click Publish in the Save As dialog box to access Save as Web options
Generally, you should start the Save as Web export by clicking Publish in the Save As dialog box, rather than by clicking Save. Clicking Publish takes you to dialog boxes where you can set options for your Web page output files. Clicking Save generates a new Web page with the options that were set the last time the Publish command was used.
When you click Publish, the Save as Web Page dialog box opens. There are two tabs on the dialog box: General and Advanced.
Figure 18. Save as Web Page dialog box General tab and Advanced tab
The General tab enables you to choose which pages you want to export from your Visio drawing. You can select individual pages in a range or the entire document. You can also select publishing options, including:
Details (shape data)
Go to Page (navigation control)
Pan and Zoom
On the Advanced tab, you can choose output format options and which graphics format is used for the Web page. Format options include VML, SVG, JPG, PNG, and GIF. If you select VML or SVG for your primary output type, you can then select a secondary output type for compatibility with older browsers. You can alter filter settings for PNG, JPG, and GIF by running a separate export directly through the filter before running Save as Web Page.
On the Advanced tab, in the Display Options section, you can choose a screen size, but note that this option works only for the PNG, JPG, and GIF formats.
Depending on which selections you make in the associated dialog boxes, after your Web page is created you can access Shape Data and multiple hyperlinks.
Figure 19. Save As Web Page enables you to retain hyperlinks, view Shape Data, and pan and zoom
Using Additional Options for Exporting Other Graphics Formats
Using Visio 2007, you can export your Visio images into many different graphics file types. In addition to the native XML and binary formats, you can save your drawings in any of the following formats:
Scalable vector graphics (.svg)
Scalable vector graphics compressed (.svgz)
Autocad drawing (.dwg)
Autocad interchange format (.dxf)
Web page (.htm, .html)
Compressed Enhanced Metafile (.emz)
Enhanced Metafile (.emf)
Graphics Interchange Format (.gif)
JPEG Interchange Format (.jpg)
Portable Document Format (.pdf)
Portable Network Graphics (.png)
Tag Image File Format (.tif)
Windows Bitmap (.bmp, dib)
Windows Metafile (.wmf)
XPS Document (.xps)
Figure 20 shows a mapping of the different types of file formats that Visio can export.
Figure 20. File formats Visio 2007 can export to
The options to output in PDF format and XPS format are not installed with the product. To enable them, download and install 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS.
Visio 2007 Connector for Microsoft Baseline Security Analyzer
The Microsoft Office Visio 2007 Connector for Microsoft Baseline Security Analyzer enables you to view the results of a Microsoft Baseline Security Analyzer (MBSA) scan in a clear, comprehensive Visio network diagram.
What's New for the 2007 Version of the Connector
Visio 2007 Connector for MBSA supports data graphics. It uses the new data graphics features of Visio 2007 to display the results of a scan.
Creating a Network Diagram for MBSA
The Microsoft Office Visio 2007 Connector for Microsoft Baseline Security Analyzer is a COM add-in that starts automatically when you start Visio 2007. The add-in monitors shapes that have the following Shape Data when they are added to any Visio drawing:
To create a drawing for use with MBSA
Start Visio 2007. Under Choose Drawing Type, from the Category options, select Network. Then, under Templates, select Basic Network Diagram.
From the Network and Peripherals stencil, drag a Server shape onto the drawing page. After the shape is added to the page, you should now see an MBSA menu item on the Visio Standard toolbar.
Figure 21. The MBSA menu
With the Server shape still selected, right-click the Server shape, and then click Properties. The Shape Data window appears.
Figure 22. The Shape Data window
In the Shape Data window, type either a valid Network Name or a valid IP Address (or both), and then click OK.
The Server shape is now configured for use with MBSA. If you pause the mouse over the Server shape, a smart tag is visible. This smart tag contains a Perform Baseline Security Scan menu item.
Using the Perform Baseline Security Scan menu item from this smart tag is the same as clicking Perform Baseline Security Scan on the MBSA menu.
Figure 23. Smart tag with Perform Baseline Security Scan menu item
Click Perform Baseline Security Scan to display the Perform Scan dialog box.
The Perform Scan dialog box lists all shapes in the drawing that are properly configured for use with MBSA. Select the computers you want to scan, select appropriate scan options, and then click OK.
During the scan, the Status window shows the current status of the running scan.
In the Status window, you can also cancel the current scan by clicking Cancel.
Figure 24. The Status window
After the scan completes successfully, the Report window displays the contents of the scan report generated by MBSA.
Figure 25. The Report window
Each scan report is stored in the individual shape and is visible in the Report window when a shape that contains a scan report is selected. You can copy a shape to another drawing and the scan report data stays with the shape.
Using the MBSA Menu
When a network diagram is open in Visio, the MBSA menu is available on the Visio Standard toolbar.
Figure 26. The MBSA menu
Clicking the Perform Baseline Security Scan menu item displays the Visio Connector for MBSA dialog box. This dialog box contains options for selecting computers to scan and options to use when scanning the selected computers.
Refer to MBSA help topics for details about each option presented in this dialog box.
Figure 27. The Visio Connector for MBSA dialog box
Import Scan Reports
On the MBSA menu, clicking Import Scan Reports displays a dialog box that enables you to select existing reports to import into the current drawing. Data from the report is used to match the report to existing shapes in the drawing.
MBSA Status Window
On the MBSA menu, clicking MBSA Status Window displays or hides the MBSA Status window. The MBSA Status window displays the current status of any scans that are running or the results from a scan that just completed.
MBSA Report Window
Clicking MBSA Report Window on the MBSA menu displays or hides the MBSA Report window. The MBSA Report window displays the scan report of a currently selected Visio shape that contains a scan report.
Using Data Graphics to Visualize Report Information
Visio 2007 introduces data graphics to help you visualize data more easily within a drawing.
Additional information is added to shapes that have scan results, including:
Figure 28. Additional information is displayed for shapes that have scan results
Color by Value
The Color by Value feature is used to visually display the Report Overview value of each scanned shape:
Black—Shape has not been scanned or a scan could not be completed
Building Custom Solutions with Visio That Add Visio Diagramming Functionality to Any Business Context
You can customize Visio 2007 to fit your specialized needs. You can extend Visio 2007 programmatically or you can extend it by integrating it with other applications to fit your industry-specific scenarios or unique organizational requirements. You can develop custom solutions and shapes and, with Visio 2007 and the Visio Drawing Control, you can create custom, data-connected solutions that make it easier to connect and display data in any context.
In this article we introduced several examples of how you can use Visio together with other applications commonly used by developers. These examples only scratch the surface of what you can do if you consider the integration possibilities available when you create custom solutions.
Both Microsoft Office Visio Standard 2007 and Microsoft Office Visio Professional 2007 provide all of the tools necessary for you to create your own custom shapes. You can also use the Visio ShapeSheet Reference to program custom behaviors into shapes.
By using common programming tools, such as Microsoft Visual Studio or Microsoft Visual Basic for Applications (VBA), you can create custom add-ins, change the menus within Visio, and cause Visio to react and respond to events.
Visio 2007 provides richer tools that are easier to use and that enable you to more quickly integrate data and diagrams from a variety of data sources. Using Visio 2007, you can automatically refresh the data in diagrams, which reduces the need for you to manually re-enter data. Visio 2007 also offers a variety of export and import options that allow you to also share data through other sources.
About the Author
Since 1997, Visimation has helped companies improve their productivity by providing visual software tools to ease business and technical tasks, and offer a broad range of consulting services focusing on Microsoft Visio as a platform for rapid development of efficient automation programs.
For more information about integrating Visio and other applications, see the following resources:
For more information about Visio 2007 integration, see the following articles: