Unmanaged Visio

28 August 2009

Making the Visio ribbon tab document-dependent

This post explains how to make a ribbon tab in Visio 2010 ribbon document-specific. Means, activate a custom ribbon tab only for a specific document.

Download C# sample project (VS2008)

Download C++/ATL sample project (VS2008)

This article discusses the implementation of a document-specific tab in a COM add-in; also, it focuses on nasty details you might be interested in if you e.g. program unmanaged C++. Note that you could do this thing by other means, e.g. by embedding your custom interface in a document template using new Visio 2010 property Document.CustomUI.

Nevertheless, one of the ways to it is:

  1. Create a Visio add-in that supports ribbon (as described in previous post)
  2. Add onLoad event to the ribbon XML. This will allow you to obtain the ribbon manager.
    <customUI onLoad="OnLoad" ...>
  3. In the event handler for the onLoad event, save passed-in ribbon manager. This is needed to force update of the ribbon.
            // this function provides us with IRibbonUI object, called when XML is loaded
           public void OnLoad(object obj)
           {
               vsoRibbonUI = (Office.IRibbonUI) obj;
           }
     
Read more »

Labels: , , , ,

22 August 2009

Getting started with Visio Ribbon

This post explains how one can customize Visio 2010 Ribbon from Visio add-in (and is based on Visio CTP). Namely, it shows how to add a custom tab to the Visio ribbon.

Download C# sample project (VS 2008 solution, 12 Kb)

Download C++/ATL sample project (VS 2008 solution, 19 Kb)

Though Visio has been resistant to innovations in user interface for quite a long time (just remember those 16-color icons in the stencils), it seems that finally "the time has come", and the ribbon interface has won the game. I started this project to estimate the amount of work one needs to adopt his add-in to the new Ribbon interface. I should mention that old CommandBars API that was normally used for user interface customization does still work for new Visio 2010; the point is that it just looks a bit unnatural, and kind of unnatural.

The way it looked in Visio 2007, native toolbar and menu: image

If you won’t do a thing, then in Visio 2010 you’ll get something like: image If you ask me, this doesn’t look like an exciting user experience… No transparency, no fancy 32-bit images, all custom toolbars (from all add-ins) are put to the “Custom Toolbars” group, all custom menus (from all add-ins) are put into “Menu Commands”, etc, etc… Wouldn’t it be much better if we make it look like that? image Here is list of materials about Office ribbon customization (though these are 2 years old and were written for Word 2007 and alike, now they became valid for Visio as well):

Read more »

Labels: , , , ,

16 August 2009

Hello world

1 Basically I started this blog to share some information and examples that might be useful for those who create application for the Microsoft Office in general and Microsoft Visio in particular (add-ins and alike).

I deal with the Microsoft Visio for quite some time already (and basically in the unmanaged code), and I feel like I can share some things that Visio community might find useful. So this blog can be considered as a "Visio developer's side notes".

Additionally, to make it not that boring, I decided to draw a picture for every post :)
Hoping all this is a good idea, Nikolay Belyh