Volume 2: Solutions and Publishing disclaimer


Deploy a Visio library solution



Download 0.72 Mb.
Page8/12
Date10.08.2017
Size0.72 Mb.
#31124
1   ...   4   5   6   7   8   9   10   11   12

Deploy a Visio library solution


A Visio library solution can contain custom Visio stencils, Visio templates, and VBA code. There are two methods for deploying these solutions. The preferred method is to publish the content using a Windows installer file, but the methods using file path discovery which have been available since the very early versions of Visio are still available.
Publishing using a Windows installer file

This method consists of creating an installer file (.msi) using Visual Studio and then setting the install locations for the Visio files using the Visio Publishing tool available in the Visio SDK.

Using the Visio Publishing tool was covered in Volume 3 in the section covering the Visio SDK. The publishing tool provides the following key features:



  • Register templates, stencils, and help files with the Visio environment

  • Add templates to the featured templates so they can be seen from the Visio Category Explorer

  • Publish localized versions of the files for multiple languages

  • Published content location is stored in the registry so retrieval is faster than with the path discovery method

  • Can utilize the Windows Installer repair and add-and-remove software features

  • Path discovery works only for individual users. Publishing your content makes your solution available to all users.



File path discovery method

Prior to Visio 2003, custom templates and stencils could be discovered by telling Visio where to search for certain file types.

To set the file paths choose File > Options > Advanced. Scroll to the bottom of the screen and choose File Locations…

From the File Locations dialog set the path to Drawings, Templates, Stencils, Help, Add-ons, and Start-up. Multiple paths can be set for each by using a semicolon as a separator between the paths.

To deploy a solution using this method copy the files to the desired location and then modify the file paths dialog to find them. A big drawback of this solution is that it must be done on each user’s machine. So if your solution is to be distributed widely, it can be somewhat tedious and error prone.


Remove VBA project data from Visio files

Before deploying a Visio library solution it is prudent to remove any unneeded VBA project data from your Visio files. In Visio 2007 and later a project skeleton is no longer created automatically. However, if you open the VBA project window from your document, even if you don’t add any project data, a project skeleton will be created within your project file. This will trigger any macro security warnings for users trying to use your Visio files.

The VBA project data can be removed by first saving the Visio file as a .vdx and then deleting the project tags and any project data using a text editor.



Deploy a Visio automation solution




Deploy a Windows Forms solution containing the Visio Drawing control

Use of the Visio Drawing control requires that each end user have a valid Visio client license. The Visio Drawing control is installed whenever Visio is installed so there is no need to include the Visio Drawing control itself as part of the installation package. If you are distributing a solution requiring the Visio Drawing control, then Visio should be installed first on the client machines before installing your solution.
Deploy an add-on developed as a Visio Solution Library (VSL)

A VSL solutions should be packaged within a Windows Installer file (.msi).

Some things to consider before implementing a VSL add-on:



  • The .vsl file runs in the same memory space as Visio. The benefit of this is that it typically gives better performance than solutions that run out of process.

  • On the other hand, because the .vsl runs in the same memory space as Visio, should the .vsl fail, it can cause Visio to fail too.
Deploy an add-in created with VSTO

VSTO allows the creation of secure add-ins. This means that a VSTO add-in can be isolated and protected from crashes in other add-ins. VSTO add-ins can be digitally signed so they will run when a system administrator sets “Require Application Add-ins to be signed by a Trusted Publisher”. They also operate using the .NET Code Access Security model meaning your VSTO add-in has to be granted Full Trust in order to be loaded by Visio.

VSTO add-ins and the .msi file used for installing them can be created with Visual Studio.

You must grant trust to the solution assemblies so that the .NET Framework allows them to execute. Evidence for the trust can consist of an assembly’s location, a strong name, a certificate, or a combination of these types of evidence.

See the articles, Deploying Visual Studio 2005 Tools for Office System SE Solutions Using Windows Installer. The links are listed at the end of this module in the section called Additional Resources.



Deploy solutions for use with multiple languages


Deploying stencil and template solutions for multiple language support can be managed using the Visio Publishing tool available in the Visio SDK.

However, even when writing code there are language considerations that should be taken into account. Planning ahead will reduce the amount of work necessary to produce a flexible solution that works across multiple languages.


Use universal names when writing code

There are many objects in the Visio object model. Those that are exposed through the user interface (masters, master shortcuts, pages, styles, and layers) change with each language version. If you had to refer to these objects using their local names, you would have to change your code for each language version of your solution you support.

To protect your code from localization issues the following objects have both a local name and a universal name: shape, master, master shortcut, page style, layer, row, and cell. For these objects, refer to their universal names in your solution code. These universal names remain constant between different language versions of Visio 2007.



Note:

The ShapeSheet presents names of cells using only the universal name.

Universal names are always used in the automation interface when working with object properties and methods that end with the character “U”. The table below shows these properties and methods.



Property or Method

Objects

Description

CellExistsU property

Shape and Style

Determines whether a cell exists by using its universal name.

CellsRowIndexU property

Shape

Gets a cell's row index by using its universal name.

CellsU property

Shape and Style

Gets a cell by using its universal name.

CellU property

Row

Gets a cell by using its universal name.

ItemU property

Addon, Hyperlink, Layers, Masters, MasterShortcuts, Pages, Shapes, and Styles

Gets an object from a collection by using its universal name.

Name property

noteNote: This is the only property that is used to get a universal name that does not end with "U."





Cell

Gets the universal name of a cell.

noteNote: Use the LocalName property to get or set the local name of a cell. For more information about accessing cells, see Accessing Cells in the ShapeSheet Spreadsheet later in this article.





NameU property

Addon, Hyperlink, Layer, Master, MasterShortcut, Page, Row, Shape, and Style

Gets or sets an object's universal name.

RowNameU property

Cell

Gets or sets a row's universal name.

DropManyU method

Page, Master, and Shape

Creates one or more new Shape objects on a page, in a master, or in a group, by using universal names to identify the shapes. Returns an array of the IDs for the Shape objects that it creates.

DropManyLinkedU method

Page

Creates multiple new Shape objects on the drawing page that are linked to multiple data rows in a data recordset. Returns the number of shape instances created and an array of IDs for those shapes.

GetNamesU method

Addons, Masters, MasterShortcuts, Pages, and Styles

Gets the universal names of all items in a collection.

GetThemeNamesU method

Document

Gets an array of universal names of themes contained in a document.





Download 0.72 Mb.

Share with your friends:
1   ...   4   5   6   7   8   9   10   11   12




The database is protected by copyright ©ininet.org 2024
send message

    Main page