共用方式為


Visio solutions

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio provides project templates you can use to create VSTO Add-ins for Microsoft Office Visio. You can use VSTO Add-ins to automate Visio, extend Visio features, or customize the Visio user interface (UI).

For more information about VSTO Add-ins, see Get started programming VSTO Add-ins and Architecture of VSTO Add-ins. If you are new to programming with Microsoft Office, see Get started (Office development in Visual Studio).

Applies to: The information in this topic applies to VSTO Add-in projects for Visio 2010. For more information, see Features Available by Office Application and Project Type.

Note

Interested in developing solutions that extend the Office experience across multiple platforms? Check out the new Office Add-ins model. Office Add-ins have a small footprint compared to VSTO Add-ins and solutions, and you can build them by using almost any web programming technology, such as HTML5, JavaScript, CSS3, and XML.

Automate Visio by using the Visio object model

The Visio object model exposes many classes that you can use to automate Visio to create diagrams for organizational charts, flowcharts, project timelines, network diagrams, office spaces, and more. The API enables you to write code to accomplish common tasks:

  • Construct and position shapes and text in diagrams.

  • Manage shape behavior based on business logic and user input.

  • Control diagram visualization such as panning and zooming.

  • Customize the application UI.

  • Import external data into Visio, link it to shapes, and display it graphically on a page.

    You can view step-by-step procedures and code examples for using the object model of Visio to work with documents and shapes in Work with Visio documents and Work with Visio shapes.

    To access the Visio object model from a VSTO Add-in, use the Application field of the ThisAddIn class in your project. The Application field returns a Microsoft.Office.Interop.Visio.Application object that represents the current instance of Visio. For more information, see Program VSTO Add-ins.

    When you call into the Visio object model, you use types that are provided in the primary interop assembly (PIA) for Visio. The PIA acts as a bridge between the managed code in the VSTO Add-in and the COM object model in Visio. All types in the Visio PIA are defined in the Microsoft.Office.Interop.Visio namespace. For more information about primary interop assemblies, see Office solutions development overview (VSTO) and Office primary interop assemblies.

Visio object model overview

You can find an overview of the Visio object model at Visio object model overview, which includes links to the Visio object model reference and the SDKs.

Customize the user interface of Visio

The Visio UI has the following customization options.

Task For more information
Customize the ribbon. Ribbon Overview

For information about customizing the UI of Visio, see the VBA reference documentation for the Visio.UIObject class.

See also