Visio Viewer for Developers
Have you heard about the Visio viewer, he’s a viewer but he still keeps on spyin’. Ok, sorry about that Little River Band diversion. ANYway…
The Visio viewer is a free download that lets non-Visio-havers view and interact with Visio files.
But did you know that you can incorporate it into your own software projects as a control?
What is the Visio Viewer?
The Visio viewer is freely available from Microsoft. If your co-workers and customers don’t have Visio installed, they can install the viewer, then view and interact with Visio drawings that you send them in a browser or in Outlook. If they have Outlook 2007, then they may already have the viewer installed, because Outlook 2007 installs the Visio 2007 viewer by default.
With the viewer, they can pan and zoom, switch pages, view Shape Data (Custom Properties), turn layers on and off, and view or hide annotations.
If you or your customers don’t have the Visio viewer, then your first stop is one of these:
If you find any more good reference to viewer topics, please leave them in the comments section below!
What’s the Developer Angle?
The viewer can also be used as a control in your own solutions. You can plop it on a form and manipulate it programmatically. In fact, Microsoft recently released a developer reference to help you to do this with less guesswork. Have a look at the Visio 2007 Viewer Developer Reference.
According to Visio Insights, who broke the story first, the Visio 2007 viewer API enables you to do the following with the control:
- Load and unload Visio drawings
- Select shapes
- Follow hyperlinks
- Display Viewer dialog boxes to the user
- Customize the size and position of the Viewer window
- Customize the user interface by changing foreground and background colors and displaying or hiding the grid and the scrollbars
- Control the color and transparency of layers in the drawing
- Control the color and visibility of reviewer markups (comments)
- Customize the toolbar by adding or removing buttons
- Respond to user actions in the Viewer interface
and the Visio 2007 Viewer Developer Reference explains how to do it!
David Parker (a Visio MVP, Microsoft Certified Provider and Visio Expert) has even created a product: the visViewer, which is a custom application that you could describe as “The Visio Viewer on Steroids”.
David has also written a blog entry about incorporating the Visio control into a custom application. Check out: Using the Microsoft Visio Viewer (and introducing visViewer).
Coexistence Problems: Visio Application & Visio Viewer
There is another reason to create a custom viewer app: you already have Visio installed on your machine, but you want to check how your drawings appear in the Visio viewer.
Yes, the problem of coexistence of Visio (the app) and Visio (the viewer) can be problematic for a number of reasons:
- Opening a Visio file in the browser with the 2003 and 2007 viewer still presents you with the problem of annoying security warnings popping up every time you open a file
(There are browser settings to turn this off, Advanced / Security, Check : Allow active content to run in files on My Computer)
- With the Visio viewer 2003, coexistence only works if you install the viewer after you install the Visio application.
- With the Visio 2007 viewer, coexistence doesn’t seem to work at all. The Visio application will always take ownership of your Visio files, so you can’t (easily) view and check your files with the viewer at all.
(I tried doing a file association with C:\Program Files\Microsoft Office\Office12\VVIEWER.DLL, but it didn’t work)
So having a simple “Visio Viewer Viewer” application becomes an almost must-have utility for people who need coexistence (unless you like to change file associations). In a custom app, you have the joyouse experience of a “security-free” viewer (no pop-ups!), and you can do something that essentially doesn’t work with 2007.
In fact, this utility will most likely be the subject of a future Visio Guy article + download.
The problem of coexistence has come up a number of times over the years in the newsgroups. The best post that I found comes from Barb Way, who works in Product Support for Microsoft Visio:
Run Viewer with Visio Installed
A little more info on this…
The Visio 2003 Viewer and Visio 2007 Viewer will both take ownership of the
Visio file extensions in the absence of a version of Visio. However, when
the Visio application (2003/2007) is installed, it will always take
ownership of the extension, regardless of the presence of a viewer. If you
try to open a Visio drawing in IE when Visio 2003 is installed, the drawing
will open via OLE inside of IE – not in the viewer. If you try the same
task on a Visio 2007 system, the full application will launch with the
If Visio is installed first, and then one of the Viewers, there will be a
temporary period during which the Viewer owns the extensions. This will
last until the application is launched – at which time the default Repair
action of the installer will restore the application settings (to own the
extensions). From that point forward, the application should maintain
Chris’ options for creating a custom solution to work around this behavior
are a good place to start. There is also an older article about how to
embed the Viewer 2003 in a web page on MSDN :
Product Support – Visio
Visio Viewer in Outlook
I have Visio 2007 installed on my machine, along with the Visio viewer. Here I find that Outlook uses the Visio viewer as a “safety” previewer for attached Visio files.
In this respect, the Visio viewer does coexist with the Visio application. But I doubt that people will resort to e-mailing .vsd files to themselves just to check their Visio work in the viewer.
Anyway, this is how it works. You open up an Outlook e-mail. You see the list of attachments just above the reading pane. If you click on one of the Visio files, Outlook will offer a do you want to preview this file message, along with a Preview File button, just as it does with Word and Excel attachments:
click to view larger image
If you click the button, the Visio viewer will be called to action. You’ll see a vector-based preview of your Visio file. You can pan, zoom and jump to pages within the document. You are essentially getting a stripped-down version of the Visio viewer, in-place in your Outlook reader!
click to view larger image
More Visio Viewer Resources
While we’re on this topic, I found some other articles about the Visio viewer that you might find interesting:
Cool Visio Icons
You might have noticed the attractive Visio icon under the magnifying glass (being viewed, get it?) at the beginning of this article, and presented here un-magnified.
If you think this Visio icon that I used for this article is cool, I should let you know that I found it on Icon Archive. It was created by Vincent Garnier (aka: Benjigamer) The downloadable icon packet and use-conditions are here.