Visio Insights
The official blog of the Microsoft Visio product team

  • Visio Insights

    Joining the Club


    In an earlier post we talked about Visio being a general purpose diagramming and drawing application that enabled specialized behavior through its extensibility model.  Custom shapes are combined with custom code to create an intelligent diagramming solution for a particular scenario.  Sometimes users like to take this extensibility notion even further by creating their own shapes to work with the solution.  We inevitably are asked how these new shapes can “join the club” or participate in the specialized behavior.


    Unfortunately there is no single mechanism for registering a shape with a solution or converting a shape to work with a solution.  Some Visio solutions provide this capability.  Others do not, forcing the user to discover the secret handshake with the solution.  We’ll look at a specific example in this post.



    The Legend feature can be found in Visio’s Brainstorming template, or the Legend Shapes stencil can be opened from File > Shapes > Brainstorming.  Special legend shapes are added to the diagram, and the Legend shape displays them with counts and labels.



    Now imagine that you need a new shape to easily identify issues to be resolved.  Here is a simple shape created with the Freeform tool.  The initial alignment box for the shape is not ideal, but that can be fixed using Shape > Operations > Combine to fit the geometry into a nice upright rectangle.


    It would be helpful to tally the issues in the diagram and have the total displayed in the legend as well.  To do this, open the Document Stencil for the diagram by going to File > Shapes > Show Document Stencil.  Then drag the issue shape over to the stencil.  You should rename the shape from Master.11 (or similar) to Issue.  You could also clean up the icon if desired.


    Next we need to make the shape work with the legend.  Drag the shape from the Document Stencil and drop it on the legend shape in the drawing.  The following message will appear.



    Choose Yes and then delete the shape sitting on top of the legend.  Now drag out Issue shapes from the Document Stencil to annotate the drawing.  The legend should reflect the total number of Issue shapes present.



  • Visio Insights

    What's in Your Drawing?


    This post will be a little experiment to try out file attachments on the blog.

    When customers send files to us, we often want to get a general understanding about the drawing contents.  This is common in scenarios where customers are concerned about performance or file size.  Visio drawings may be carrying some excess baggage along.

    In addition to shapes on the page, a Visio document contains information about master shapes, styles, layers, fonts, colors, data and other items.  These collections of information are used to accurately present the shapes on the page.  However, they do not automatically get purged when shapes are deleted from the diagram.

    Take the simple example of a flowchart.  If you drag a Process shape onto the drawing page, Visio adds a copy of the Process master shape to the document and places an instance of this master shape on the page.  If you delete the Process shape from the page, the master shape remains.  Over time unused master shapes pile up.  Normally this is no big deal, but some shapes contain large bitmaps or other complex information that will quickly increase file size.

    Before you go out and delete every master shape from your document, keep in mind that master shapes are highly efficient when they are actually used in the drawing.  If you took a drawing with many copies of the same shapes and then deleted the master, you would find the resulting document much larger and slower.

    The attached DrawingAnalyzer.vsd document is a handy little tool written in VBA for counting the shapes in a drawing and determining whether there are unused master shapes.  Also the tool counts shapes on the page with no master shape, and it keeps track of the level of grouping among shapes.  More nested groups mean much slower performance.

    To use the tool, open the file in Visio along with any other document you want to analyze.  Make sure the document to be analyzed is in the active window.  Then go to Tools > Macro > DrawingAnalyzer > ThisDocument > GetDrawingStats.  Then open the VBA Editor (Alt+F11) and look in the Immediate Window (Ctrl+G) at the output.  Here's a sample result:

    Total Pages:             3
    Total Shapes:            495

    Top Level Shapes:        11
    Group Shapes:            92
    Max Nesting Depth:       3
    Total Masters:           13
    Unused Masters:          0
    Shapes w/o Masters:      36
    Total Patterns:          0
    Unused Patterns:         0
    Total Styles:            9

    A top level shape is a shape directly on the page.  All other shapes are found inside of groups.  In this example, there are only 11 shapes spread across the 3 pages in the drawing.  However, the total number of shapes is 495, meaning there are lots of shapes inside groups.  There are even groups inside groups inside groups as evidenced by the maximum nesting depth of 3.  This is not terribly efficient.  All 13 master shapes in the document are used in the drawing, so that is good.  36 shapes have no master.  If any of these shapes are similar, it would be more efficient to create a master shape for them.

    The DrawingAnalyzer.vsd file is saved in Visio 2000/2002 format.  Please post a comment if you have difficulties getting the file.  As we said, this is a test.



  • Visio Insights

    No More Template Help


    A common newsgroup question is how to prevent the Template Help task pane from appearing every time a document is opened.  Not only do we see lots of newsgroup posts about this, it turns out that one of the more common pieces of feedback we receive through Rate this Template is “Let me disable this task pane”.



    Here are the steps to disable automatically showing the task pane:


    1)      Go to Tools > Options in the menu

    2)      Click on the General tab and choose Service Options at the bottom

    3)      Select the Online Content category and uncheck “Show Template Help automatically…”



    The task pane is intended to help people learn more about various diagram types.  Unfortunately the design tends to focus on the initial usage experience (having the template help in your face) at the expense of ongoing productivity (having lots of drawing space).  Perhaps the biggest problem is that there is no place on the task pane itself to disable the automatic behavior.


    The good news is that there is no Template Help task pane in Visio 2007.  There is a link to template help at the bottom of the Getting Started screen.  It is grouped with all the other content available from Office Online.  Hopefully this is a better location both for those that want to find template help and those that do not want to be bothered by template help.




  • Visio Insights

    Running with Characters, part 2


    In the previous post we looked at the Characters object in Visio and used it to find the runs of formatted text in a shape.  In this post we’ll complete the scenario by reading the formatting information from the Shapesheet to match it up with the text runs.  Here is our sample shape text with mixed formatting.



    We walked through the function getTextRunList to generate a list of the substrings within shape text.  Each string represents a text run - a set of characters that have the same formatting applied.  So what are the formatting properties for each text run?  This information is stored in the Character section of the Shapesheet.



    Each row in the Character section corresponds to a text run.  We can read the Shapesheet cells in these rows and associate the properties with the substrings in the text run list.  Before looking at the code to do this, we need to create a simple structure to store the text and formatting information.

        struct VisioFormattedTextRun
            public string text;
            public int font;
            public double size;
            public string color;
            public bool bold, italic, underline;


    This structure holds the text for the text run as well as six properties for the formatting.  There are many more properties that describe Visio text, but these are the most common.  Now let’s look at a function to extract the formatted text from a shape and generate a set of VisioFormattedTextRun objects.  Note that you will need the getTextRunList procedure from the previous post.


    using System;

    using System.Collections.Generic;

    using System.Text;

    using IVisio = Microsoft.Office.Interop.Visio;


    public class TextUtilities


        public static List<VisioFormattedTextRun> getFormattedShapeText(IVisio.Shape vsoShape)


            List<VisioFormattedTextRun> formattedShapeText = new List<VisioFormattedTextRun>();


            short charSection = (short)IVisio.VisSectionIndices.visSectionCharacter;


            if (vsoShape.get_CellsU("HideText").ResultIU == 0)


                // Break up the shape's text into a set of text runs

                List<string> textRunList = getTextRunList(vsoShape);


                // Iterate through the rows in the Characters section to get the formatting matching each text run

                for (short iRow = 0; iRow < vsoShape.get_RowCount(charSection); iRow++)


                    VisioFormattedTextRun textRun = new VisioFormattedTextRun();


                    // Get the text for this row

                    textRun.text = textRunList[iRow];


                    // Make sure text is not empty before adding run

                    if (textRun.text.Length > 0)


                        // Get formatting for this text run

                        textRun.color = vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterColor).get_ResultStrU(IVisio.VisUnitCodes.visNoCast);


                        textRun.font = (int)vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterFont).ResultIU;


                        textRun.size = vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterSize).get_Result((short)IVisio.VisUnitCodes.visPoints);


                        int styleProp = (int)vsoShape.get_CellsSRC(charSection, iRow, (short)IVisio.VisCellIndices.visCharacterStyle).ResultIU;


                        textRun.bold = ((styleProp & 1) == 1);

                        textRun.italic = ((styleProp & 2) == 2);

                        textRun.underline = ((styleProp & 4) == 4);


                        // Record text run






            return formattedShapeText;




    Let’s walk through this procedure.  First an empty list of VisioFormattedTextRun objects is created.  Then we check the HideText cell to find out if the shape text is actually being displayed.  This sample only retrieves the text if HideText is 0 (i.e. text is visible).  Next is the call to getTextRunList to create a list of text substrings with common formatting.


    The main part of the routine iterates through all the rows in the shape’s Character section.  A new VisioFormattedTextRun object is created.  The text property is set to the current substring in the text run list.  Then individual Shapesheet cells are read from the current row in the Character section.  The six formatting properties are assigned, and the VisioFormattedTextRun object is added to the overall formatted shape text list.


  • Visio Insights

    Running with Characters


    When working with shape text through automation, the Text property of a Shape is generally sufficient to get and set the text.  However, this simple property ignores the fact that Visio text may have rich formatting applied or that the text is composed of text fields.  If you need a more industrial-strength way to retrieve and modify shape text, use the Characters object for the Shape.


    Characters is a kind of do-it-all object for manipulating text.  It is capable of breaking text down into individual characters or sets of characters.  The Characters object can describe text in much the same way that the Visio Shapesheet stores shape text.  Consider the following shape with text:



    The shape text consists of a single line with a variety of formats applied to the characters.  Visio has to keep track of not just the characters but their formatting as well.  It does this using text runs.  A text run is a set of characters that have something in common.  Typically a text run is a set of characters with identical formatting.  That is how Visio represents text in the Shapesheet.



    Our sample text is described by six text runs.  The number in the first column defines how many characters are in the run.  Thus “Hello “ is described by the first line.  “World” is in the second line.  The space after “World” is next.  Then “Sample “, then “Text”.  Finally Visio (starting in 2003) terminates text with a non-visible character.  Note that this final character is not reported when using the Shape.Text property, but it is reported using Shape.Characters.Text.  Our sample text varies mostly by the Style property, which defines whether there is any bold, italics or underlining.  Also the Color property varies for one text run. 


    There is also a notion of a paragraph run, which is the collection of all characters with the same paragraph formatting properties.  Note that, like a text run, a paragraph run can span across carriage returns because it describes the formatting not the structure.  The number in the first column defines the number of characters in the run.  In our example all the characters in the shape text use the same paragraph formatting properties, so Visio put a zero in the column.  This would similarly apply to the Characters section if there were no variation in character formatting.


    The Visio SDK has sample code demonstrating how to set up custom formatting on shape text, but there isn’t an example of reading the text back.  Let’s take a look at a function that can analyze Visio shape text and return the specific text runs that describe the formatting boundaries.


    using System;

    using System.Collections.Generic;

    using System.Text;

    using IVisio = Microsoft.Office.Interop.Visio;


    public class TextUtilities


        public static List<string> getTextRunList(IVisio.Shape vsoShape)


            List<string> textRunList = new List<string>();


            // Get the Characters object representing the shape text

            IVisio.Characters vsoChars = vsoShape.Characters;

            int numChars = vsoChars.CharCount;

            int runBegin = 0, runEnd = 1;


            // Find the beginning point and end point of every text run in the shape

            for (int c = 0; c < numChars; c = runEnd)


                // Set the begin and end of the Characters object to the current position

                vsoChars.Begin = c;

                vsoChars.End = c + 1;


                // Get the beginning and end of this character run

                runBegin = vsoChars.get_RunBegin((short)IVisio.VisRunTypes.visCharPropRow);

                runEnd = vsoChars.get_RunEnd((short)IVisio.VisRunTypes.visCharPropRow);


                // Set the begin and end of the Characters object to this run

                vsoChars.Begin = runBegin;

                vsoChars.End = runEnd;


                // Record the text in this run



                // As the for loop proceeds, c is set to the end of the current run



            return textRunList;




    This C# code uses a .NET 2.0 Generic string list to store each text run found.  The Characters object is retrieved from the text, and the total character count is stored.  Then the procedure iterates through the characters from beginning to end.  However, the For Loop is unusual because it does not increment on a character by character basis.  Let’s examine the For Loop more closely.


    The purpose of the For Loop is to find text runs and add them to the string list.  First a substring within Characters is defined by setting the Begin and End properties of Characters.  This substring is initially just the next two characters in the text.  Then the boundary of the text run containing those characters is established by calling RunBegin and RunEnd.  These methods search for the first and last characters of the text run containing the substring.  A new substring is defined by updating the Begin and End properties to match RunBegin and RunEnd.  This substring is added to the text run list.  Since the procedure has located the end of the current run, the For Loop is incremented to start at this position when looking for the next text run.


    Once you have a list of the text run strings, you can match them with the property information retrieved from the Characters section of the Shapesheet.  This gives a more complete description of the text contents.  There are other uses for RunBegin and RunEnd beyond character formatting.  By passing other flags to the methods, you can get the paragraph runs instead or even individual words or text fields.


  • Visio Insights

    Sizing Shapes to Text


    In a previous post, we saw how to use the ShapeSheet to resize text based on a shape’s size.  A related question we sometimes hear is how to make a shape automatically resize to contain its text.  Visio includes some shapes that resize based on their text.  Go to File > Shapes > Visio Extras > Callouts and try out the shapes near the top of the stencil.  Let’s see how to build this into a shape.

    People often want to fit more text into flowchart shapes.  We can make the text smaller for shapes that cannot fit all the text, but this sometimes makes diagrams difficult to read.  In other cases, it is OK to resize shapes based on the amount of text they contain.  Let’s say we have this piece of a process flowchart.

    The size of the Document shapes is unimportant, so we can create a formula to control the height of the shape.  Select the shape and open its ShapeSheet by choosing Window > Show ShapeSheet.  Visio opens a new window that shows the properties that drive the shape’s behavior.

    The shape is taller, but the text still doesn’t fit right.  In this case, the Document shape is designed to keep the bottom of the text block above the rounded part of the shape, preventing it from being obscured.  We can just add a little buffer to the height of the shape.

    But if the shape is resized manually by adjusting the green handles shown when the shape is selected, the formula will be lost.  We want the shape to always be at least as tall as the text it holds.  We can use the SETATREFEXPR formula to “pick up” the height that is set by manipulating the green handles.  Then, use MAX to compare that to the height from the formula above and use the larger of the two.

    The shape still looks the same, but now if we resize the height manually, the formula is not lost.  And if we try to make the shape smaller, Visio only allows it to shrink small enough to contain all the text.

    If this formula were applied to all Document shapes, each one would be a different size based on the amount of text it contains.  We can add a condition that keeps the shape at least as large as it was originally.  With this, shapes may resize larger but never smaller.  Another MAX condition ensures that Visio chooses the largest of the original size (0.75 in.), the calculated size and the manually set size.

    The SETATREF trio of functions can be a little tricky to learn, but contain a lot of power for building formulas that interact well with manual changes made through Visio’s user interface.  More on these in a future post.


  • Visio Insights

    Sizing Text with Shapes


    We occasionally get questions about how to size shapes to text or text to shapes.  While most Visio shapes do not behave like this by default, both cases are made possible through ShapeSheet formulas.  In fact, Visio includes some shapes that resize based on their text.  Go to File > Shapes > Visio Extras > Callouts and try out the shapes near the top of the stencil.  Let’s look at how to make a shape resize its text based on its width or height.


    First, select a shape on the page.  We’ll start with a simple Process shape from the Basic Flowchart stencil.  Open its ShapeSheet by choosing Window > Show ShapeSheet.  Visio opens a new window that shows the properties that drive the shape’s behavior.



    In the ShapeSheet window, scroll down to the Character section.  The Size cell is set to “8 pt” which matches the text size shown in Visio’s Formatting toolbar.



    Let’s say 12 pt is the baseline size we want for our text at the shape’s current size of 1 inch by 0.75 inch.  We want the text to size with the width of the shape.  A simple formula in the Size cell achieves this.



    This scales a base size of 12 pt by the width of the shape.  (Width is the name of a cell in the Shape Transform section, at the top of the ShapeSheet.)  Our shape’s text is now 12 pt.  Note that if we do not specify a unit, Visio assumes a default that is appropriate for the locale.  Multiplying by 1 pt scales the Width to points.



    If the shape is stretched to twice its original width, the text becomes 24 pt.



    What if we want the text to also size with height?  What if we only want the font size to change in increments of 2 points?  We just need to change the formula.  This formula scales the text size based on the larger of the two dimensions in 2 pt steps.



    We don’t want to lose this formula when manually setting a font size using the Formatting toolbar.  Wrapping the formula in a GUARD() will prevent it from being changed, even from the toolbar.  The SETATREF functions offer ways to combine formulas with changes made through the user interface, but are a bit more complex to use.


    All of the ShapeSheet cells and formulas are described in the Visio SDK documentation – downloadable or online at MSDN.  In a future post, we’ll look at the reverse of this behavior, how to resize shapes based on the text they contain.



  • Visio Insights

    Adding Your Own Shapes to Visio


    Visio users and developers often wonder how to distribute their newly created Visio shapes to their colleagues, friends and family (all depends on your friends and family I guess J). Visio offers two mechanisms to publish content, each suited to different situations.  This blog entry covers both.  But first, an introduction for those new to content creation.

    What’s content?

    In the Visio world, content refers to shapes, stencils and templates; if you’re familiar with these concepts, please skip to the next section, if not please read on.

    ·         Master shapes are the basic unit of content; they are Visio entities that you can assemble on a drawing page that graphically represent a real-world object or concept. Visio provides a rich set of pre-made master shapes and also enables the creation of custom shapes. To get started authoring shapes, read through this Visio Insights blog posting as well as this set of documents from Microsoft Office Online.


    ·         Stencils are collections of related master shapes that are presented together in the UI. Again Visio provides a large set of pre-made stencils and lets you create your own stencils containing custom made and/or pre-built Visio shapes by following the steps outlined here. Stencils files have a “.VSS” or “.VSX” extension.


    ·        Templates are Visio files that set up the Visio workspace for a particular drawing type by opening appropriate stencils, opening anchored windows and setting page properties such as scale and grid. For example the Space Plan template that ships with Visio opens four stencils, changes paper size and scaling. Instructions on how to create templates may be found here. Template files have a “.VST” or “.VTX” extension.


    Publishing Content

    Publishing a piece of content to Visio adds entry points to the user interface side-by-side with content created by Microsoft. For a stencil this translates into a menu entry added to the File > Shapes fly-out menu while for a template this means an entry in Visio’s startup screen (as seen below) and in the File > New fly-out menu. In this blog entry we will focus on publishing templates to Visio; publishing stencils is quite similar.



    Method #1: Sharing Templates using Path Discovery

    The simplest way to publish a template to Visio is to use the Path Discovery method described below:


    1.       Copy your template and supporting stencils to a known location on a drive.

    2.       Add the location defined in step 1 to Visio’s “Template Paths”; this tells Visio where to find extra content to populate its startup screen. This can be done manually by following the steps here or may be automated using code that sets the TemplatePaths property on the Visio Application object.

    3.       Restart Visio – your template should appear in the (Other) category.

    The advantages of this approach are:

    ·         It is simple.

    ·         It is supported across most versions of Visio.

    It however has a few drawbacks:

    ·         Your users may be subjected to potentially long and error prone manual work.

    ·         Your templates will always end up in the (Other) content category in the startup screen.

    ·         You don’t have any way of repairing content on a user’s machine if it gets damaged.

    ·         You cannot control which language of Visio will load your stencils and templates. 

    ·         This approach does not scale well. The Path Discovery publishing method does just that: every time you boot Visio it searches a user’s hard drive for content files – an expensive operation.


    Sharing templates through Path Discovery is good for small scale content deployments as well as deployments to older versions of Visio.

    Method #2: Sharing using the PublishComponent System

    The PublishComponent system introduced in Visio 2003 lets developers use Windows Installer technology for template distribution to register their content with Visio in a richer and more robust way. The main advantages of this method are quite interesting:

    ·         The Windows Installer setup wizard is familiar to users and easy to use.

    ·         You may choose where your content appears in the File > Shapes or startup screen hierarchies.

    ·         You benefit from Windows Installer repair, install-on-demand and add/remove features.

    ·         You may choose what language versions of Visio to publish your content to.

    ·         The approach scales well: Visio only rebuilds its content cache, a moderately expensive operation, when new content is published.

    ·         The approach is tried and tested since the product publishes its own content this way since the 2003 release.  

    That said, using the Publish Component system is:

    ·         A little more complicated than the Path Discovery method.

    ·         Will only work for Visio 2003 and or later.

    To use this method you’ll need Visual Studio .NET or later, the Visio 2003 SDK (or the Visio 2007 Beta SDK) and the following steps:

    1. Create a setup project in Visual Studio.
    2. Select the "Application folder" and change its default location property to your target install location. Add your template and their supporting stencils to this location by dragging files into the folders. Your project should look something like the figure below at this point.


    1. Build the project. This will produce an MSI file - a multi-table installation database that is used by windows to coordinate setup.

    If you installed the package as it is; Visio would not discover the files the MSI installed. To notify Visio on the whereabouts of these files, the next thing to do is populate the PublishComponent table of the MSI produced above with registration data. Once installed, this extra information will force Visio to rebuild its content cache and incorporate and display the new templates and stencils.

    The extra information you need to add may be found here. Be warned however, it is not for the faint of heart to enter this data manually. For those of us who would rather not spend their Saturday night writing MSI tables entries you can follow the steps below using the PublishComponent tool shipped in SDK to populate the appropriate MSI table easily:

    1. Install the Visio SDK & start the publish component tool (this tool may be found in the Start menu entry for the Visio SDK).
    2. On the File menu, select New. It will prompt you for an MSI; navigate to the one that you've just built.
    3. This will present the Visio Files that are in MSI. You must now, for each entry:
      1. Set the LCID of the language for which you want the templates to be accessible in. Do the same for the supporting stencils.
      2. Set the position in the Visio startup screen hierarchy you want the template to live in. This is defined by separating different levels of the hierarchy by “\” symbols for example: “MyTemplateCategory\MyTemplateSubCategory\MyTemplateName”. Do the same with the supporting stencils, setting their location in the File > Shapes fly-out.

    To make the changes described above double click on each entry to bring up the “Template Information” dialog seen below, or its counterpart the “Stencil Information” dialog.


    1. Press the "!" button in the tools toolbar; this will make modifications to the MSI's Publish Component table.
    2. Voilà… you’re done.

    The MSI can now be distributed; Windows Installer and Visio will do the rest. Although we haven’t discussed it here, the same techniques can be used to publish add-ins and help files. For the curious, use ORCA and the guidance in the KB article above to understand what modifications the tool made to the MSI.

    As a final note, you’ll see that the template you just published shows up in the startup screen, however the template preview is blank; I’ll leave it up to crafty souls out there to figure out how to get template preview’s this working… OR you could stay tuned to the Visio Insights blog for more info =).


  • Visio Insights

    Shapes in the Cloud


    If you can’t find the shape you’re looking for in Visio, it may be available online. There are several sets of shapes available only on the Web. In this post, we’ll talk about these shapes and how to find them.


    The online shapes can be accessed using the Search for Shapes feature in Visio 2003 or Find Shape in Visio 2002. You’ll need to have an Internet connection, and you’ll need to check the Visio Web Shapes option on the Shape Search tab in Tools > Options.



    Geographic Map Shapes

    There are Visio shapes representing most of the country/regions of the world (some are omitted because their boundaries are in dispute). These shapes are available to users of English, French, German, and Japanese language versions of Visio 2002 and 2003. In addition, the individual U.S. states are available to users of U.S. English Visio.

    The best way to get the whole set of world map shapes is to enter “World Maps” (including quotes) in the Search for Shapes field at the top of the Shapes window. If you’re using U.S. English Visio, enter “United States Maps” (including quotes) to get the shapes for all the states.



    Once you’ve added these shapes to your drawing by dragging and dropping them from the search results window, you can format them like any other Visio shapes and you can right-click on them to arrange them in their correct geographic locations using the “Arrange To Page” and “Arrange To Shape” commands on the right-mouse menu. See the articles on the Microsoft Office Online site for more details on working with these shapes. There are separate instructions for Visio 2002 and Visio 2003.

    Business Process Modeling Notation Shapes

    There is a set of Business Process Modeling Notation (BPMN) shapes available online to users of English Visio 2003. Enter “BPMN” in the Search for Shapes field to see the full set of shapes available.


    Note: The BPMN shapes were based on a pre-1.0 version of the BPMN specification, and there have been a number of changes to the specification since then so they aren’t completely up to date. However, several third-parties have created BPMN templates for Visio.

    Six Sigma Shapes

    For the Six Sigma practitioners, there are three sets of shapes available online for English Visio 2003:

    • Six Sigma House of Quality: Lets you assemble a House of Quality matrix diagram. Enter “House of Quality” in the Search for Shapes field to get these shapes.
    • Six Sigma graphs: Shapes for graphs commonly used in Six Sigma, such as curves, histograms, and box plots. Search for “Six Sigma graphs”.
    • Six Sigma formulas: Includes some of the mathematical formulas used in the Six Sigma methodology. Search for “Six Sigma formulas”.


    Other Sources for Shapes

    There are other sources for third-party shapes in a wide variety of industries. These include the list maintained by Visio MVPs (Microsoft “Most Valuable Professionals”) as well as the Visio Cafe site.



  • Visio Insights

    Shortcuts to Edit in Visio


    There is a lot of cool functionality in Visio, and some may be more accessible than you think. Especially for those of you who are keyboard aficionados, keyboard shortcuts in Visio could save you time better spent in polishing your diagram.


    Here are a few of our favorite shortcuts:


    1) Getting around your diagram

    • Zoom in (Ctrl + Shift + Left-click  or Ctrl + Mouse wheel up)
    • Zoom out (Ctrl + Shift + Right-click or Ctrl + Mouse wheel down)
    • Zoom to selection (Ctrl + Shift + Left mouse drag)
    • Zoom to whole page (Ctrl + W)
    • Pan (Ctrl + Shift + Right mouse drag), Pan right  (Shift + Mouse wheel up), Pan left (Shift + Mouse wheel down)

    2) Select, add text, and connect your shapes, as easy as 1-2-3!

    • Pointer tool (Ctrl + 1)
    • Text tool (Ctrl + 2)
    • Connector tool (Ctrl +3)  (Note that if the Connector tool is selected and a shape is selected, dropping a new shape adds it connected to the first one)

    3) Layout and layering of shapes

    • Bring to front (Ctrl + Shift + F)
    • Send to back (Ctrl + Shift + B)
    • Group (Ctrl + Shift + G)
    • Ungroup (Ctrl +Shift + U)
    • Align Shapes (F8)
    • Align shape to original X or Y axis when moving shape (Shift + Mouse drag)
    • Nudge shape (Shift + ←,↑,→,↓)

    4) Duplicating selected shape

    • Copy (Ctrl + C), then paste (Ctrl + V), or
    • Ctrl + mouse drag selected shape to duplicate  (Tip: you can also hold Shift to align the duplicated shape to the original X or Y axis)       

    5) Switch page

    • Previous Page (Ctrl +PageUp)
    • Next Page (Ctrl + PageDown)

    6) Full screen (F5)

    7) Open Visual Basic Editor (Alt + F11)


    As Mai-lan’s blog mentioned before, Dan Brown has a keyboard shortcut mouse pad available here.


    Also, for a complete list of Visio shortcuts see here.

  • Visio Insights

    Name and NameU


    When programming in Visio it is important to realize that many Visio objects have more than one name.  Objects such as Pages, Masters, Cells and others have a local name and a universal name.  Why two names?  To address the problems that arise when combining the needs of localization (translating strings into multiple languages) with the needs of solution development (having a constant way to refer to things).


    The local name is a friendly name that is displayed in the Visio user interface.  For Visio’s own content, this is a string translated for the product sku of Visio (i.e. German strings in German Visio).  Users have the ability to rename Page and Master and Cell objects, and that changes the local name.  Local names allow users to see things in a language that makes sense to them.


    The universal name is hidden from the user interface and can only be updated through automation.  This keeps a universal name consistent across product versions and user edits.  A constant name allows solution developers to refer to objects by an identifier that makes sense to them.  This identifier works no matter what is displayed for the local name.


    When working with Visio objects, developers should always use universal names to reference their objects.  This advice applies to more than names.  A number of properties and methods in the Visio API have universal syntax equivalents.  If you find a property and notice the same property exists but ending in a ‘U’, use the universal property.  A classic example is to use the FormulaU property to get and set formulas instead of Formula.


    There is one special case where setting the local name of an object will automatically update the universal name to match.  When the name of an object is changed the first time, both the Name and NameU properties are set to the new name.  All subsequent changes to Name do not affect the NameU property.  The sample code below illustrates this behavior.


    Public Sub NameUDemo()


        'Create a new master shape

        Dim vsoMaster As Visio.Master

        Set vsoMaster = ActiveDocument.Masters.Add


        'Check the default Name and NameU property

        Debug.Print "Initial Name/NameU:", vsoMaster.Name, vsoMaster.NameU


        'Set the name of the master for the first time

        vsoMaster.Name = "Apple"


        'Check the current Name and NameU property

        Debug.Print "Current Name/NameU:", vsoMaster.Name, vsoMaster.NameU


        'Set the name of the master for the second time

        vsoMaster.Name = "Banana"


        'Check the current Name and NameU property

        Debug.Print "Current Name/NameU:", vsoMaster.Name, vsoMaster.NameU


    End Sub



    Initial Name/NameU:         Master.0      Master.0

    Current Name/NameU:         Apple         Apple

    Current Name/NameU:         Banana        Apple


  • Visio Insights

    CAD Integration in Visio


    While Visio began mainly as a diagramming package for business, the product has always been capable of making technical drawings.  Visio supports measured and scaled drawings.  It has features such as layers, guides and dimensions to help users create complex and precise drawings.  Not surprisingly then, some of the earliest adopters of Visio were engineers and technical drawers.  This group loved the combination of power and simplicity that Visio provides.


    In the engineering software marketplace, one of the most ubiquitous applications is Autodesk’s AutoCAD.  Because AutoCAD is so broadly used, it was essential for Visio to offer the ability to work with AutoCAD drawings.  By integrating with CAD software, Visio connects into engineering and design processes, and it extends technical drawing to people in the organization that either don’t have the training to use CAD software or don’t have the resources to afford CAD software.


    Before describing the CAD integration features in Visio, we need to point out which CAD drawings Visio can work with.  Visio 2003 can work with DWG and DXF files saved in the AutoCAD 2000 format (R15) or earlier.  Users working with newer versions of AutoCAD must be sure to save their drawings in a format that Visio will read.


    The basic CAD integration features in Visio are import, conversion and export.  Import is the ability to open or insert a CAD drawing into a Visio document and display the drawing on a Visio page.  A drawing is opened using the File > Open menu command and changing the file type to AutoCAD drawing.  A drawing is inserted using Insert > CAD Drawing from the menu.



    The CAD drawing remains in its native form inside an ActiveX control, but users can choose the insertion scale and layer visibility for the drawing contents.  These properties are accessed by right-clicking on the CAD drawing object and choosing CAD Drawing Object  > Properties.



    Conversion is the process where some or all of the contents of a CAD drawing are changed into Visio shapes and placed directly on the page.  The conversion command is accessed by right-clicking on the CAD drawing object and choosing CAD Drawing Object  > Convert.



    Export is the ability to save a Visio drawing out as a CAD drawing.  Visio shapes are converted to CAD entities, and any inserted CAD drawings are written back out as is.  A drawing is exported using the File > Save As menu command and changing the file type to AutoCAD drawing.


    Visio and AutoCAD use very different ways to describe a drawing.  Thus translation between a Visio document and a CAD document is not perfect.  There are many differences between Visio shapes and CAD entities such as with text or dimensions or fills / hatches.  Also Visio shapes are large and complex while CAD entities are numerous and simple.  It would be fairly common for a CAD drawing to contain 20,000 entities, but Visio does not normally handle 20,000 shapes at a time.  Expect performance and memory issues if you convert such a drawing.


    Because of the challenges converting between AutoCAD and Visio, the most common integration scenario is to import a CAD drawing into Visio but leave it in CAD form.  Then you draw on top of the CAD entities using Visio shapes.  Consider a floor plan imported from CAD that has Visio furniture shapes or electrical wiring drawn on top.  If you want to save everything back to AutoCAD, there are some gotchas to be aware of.  In order for Visio to correctly export both Visio shapes and CAD drawing entities, the CAD drawing must have been imported into Visio using File > Open (not Insert > CAD drawing).  Opening a CAD drawing directly from a file causes Visio to properly set up the page scale and page origin to match the contents of the CAD drawing.


    Visio has made improvements in its CAD integration feature set every release, but there are still some issues with Visio 2003 that make conversion and export problematic at times.  Visio 2007 remedies many of these issues.  If you work with CAD drawings, please tell us how you use them with Visio.  If you are having trouble using Visio with your CAD drawings, we’d like to hear about that too.  In a future post we’ll talk about some specific issues in Visio 2003 and changes in Visio 2007.



  • Visio Insights

    Recruiting for the Visio Customer Council


    [All of the Visio blogs are making this announcement about the Visio Customer Council.]

    We're always looking for ways to better understand the needs and concerns of Visio customers. To that end, one of the tools we use is the Visio Customer Council.

    Council members are uniquely positioned to have their voices heard by the designers and developers of Visio. Members can provide feedback on proposed features and interact, face-to-face, with the Visio product team. Council members share their views in person, through regular conference calls, and in electronic mail.

    There are a limited number of Council member positions, and members serve for a period of one year. We are recruiting for the 2006-2007 council now.

    If you are interested in helping shape the next generation of Visio, we'll ask you to:

    • Participate in monthly conference calls with the product team;
    • Come to Redmond at least once a year to attend an in-person, two- or three-day Visio Customer Council Symposium;
    • Review and provide detailed feedback on proposed feature designs;
    • Install, use, and provide feedback on Visio beta software;
    • Respond to questions from the product team via phone or e-mail;
    • Host Visio product team members at your place of business from time to time to understand more about how you and others at your organization use Visio;
    • Sign a nondisclosure agreement with Microsoft.

    Since the readers of our blogs are among the most dedicated Visio users, we'd like to give you the opportunity to join the Council. If this sounds like something that would interest you, please contact us by e-mail, and we'll get our Planning group in touch with you.

  • Visio Insights

    Creating a Multi-shape


    Earlier this week we began creating a digital clock shape.  In the previous post we used Visio’s shape operations feature to construct a digit shape for our clock.  Today we will add a behavior to the digit to make it display any numeral required.  Then we will complete the clock shape.



    Our digit shape has seven geometry sections to represent the segments that make up the digit.  We could make ten copies of our shape and delete the unneeded segments in each to make all ten numerals.  However, our digital clock requires a single digit shape that is capable of displaying any numeral.  A particular numeral is shown by showing and hiding the correct set of segments.



    This special behavior will be defined using formulas we add to the Shapesheet of the digit shape.  For those unfamiliar with the Shapesheet, here are the essential things to know to work with a shape:


    • Open the Shapesheet window for a shape by selecting it and choosing Window > Show Shapesheet
    • All the properties of a shape are stored in cells (grouped into sections), which may contain static values or formulas that evaluate to a value
    • Some sections do not exist until you add them using Insert > Section
    • Many sections allow new rows to be added by clicking in the section and choosing Insert > Row 

    A single User-defined cell named Digit is created to specify the current numeral to display in the shape.  The NoShow cell in each geometry section is used to determine the visibility of the geometry.  We enter formulas in each NoShow cell to return True or False depending on the value in User.Digit.



    Each NoShow formula is a little different since it must control the visibility of a specific segment in the digit shape.  The seven NoShow formulas are listed below.  If you are building your own version of the digit shape, your geometry sections may be in a different order.  Therefore you need to work out for yourself what formula goes where.










    You can now test the digit shape by entering each of the 10 possible numerals in the User.Digit cell to verify that the correct geometry appears in each case.  The digit has been transformed into a multi-shape – a single shape that can take on multiple appearances.  Now we can use the digit shape to complete the clock.


    The digital clock is composed of four digit shapes for the hours and minutes, plus a pair of dots separating the hour and minutes, plus a rectangle to group everything together.  Four copies of the digit shape are arranged side by side.  Then two small squares are drawn and formatted to match the digit shapes (using Format Painter).  You can use the Combine command from the Shape > Operations menu to combine the two squares into one shape for efficiency.  Then a rectangle is drawn around everything.  The rectangle is moved behind the other shapes using Send to Back and given a thicker border with a slight corner rounding.



    Next we need to assemble all the shapes into a group.  Rather than selecting everything and grouping it, we will convert the rectangle shape into a group.  This is more efficient because it takes advantage of the ability for group shapes to have their own geometry and text.  The rectangle is selected and the Convert to Group command is chosen from the Shape > Grouping menu.  With the rectangle still selected the other shapes are added to the selection using Shift+Click.  The Add to Group command is chosen to make the digits and squares sub-shapes of the rectangle.


    The group shape will keep track of the time to be displayed in the clock.  It will break out the time into hours and minutes.  Three User-defined cells are added to the group’s Shapesheet to track these values.  The time is placed in the User.Time cell, which is set to the NOW() function for this example.  This function returns the current date and time and will automatically refresh about every minute (or sooner if the user is taking other actions).



    Each digit shape uses the hours and minutes information to determine what numeral to display.  The User.Digit cell in each digit shape is given a special formula to extract the digit from the group’s hour or minute value.  The formulas below are placed into the four User.Digit cells.  The Sheet.ID in these formulas should be the Sheet.ID of the group shape.  This is easily found by noticing what Sheet.ID is referenced by the formulas in the Shape Transform section of the digit shape.


    First Hour Digit:           INT(Sheet.14!User.Hour/10)

    Second Hour Digit:      MODULUS(Sheet.14!User.Hour,10)

    First Minute Digit:        INT(Sheet.14!User.Minute/10)

    Second Minute Digit:   MODULUS(Sheet.14!User.Minute,10)



    This completes the digital clock!  We created complex geometry using shape operations to make construction easy.  Then we built a multi-shape with special behavior to selectively display the geometry.  Finally the components were wrapped in a group to control the multi-shapes from a single input value.  The clock in this example uses a total of six Visio shapes for the display.  Using the techniques shown here though, it is possible for you to combine all the digits together with the squares into a single multi-shape – reducing the total shape count to two.  We’ll explore this issue of minimizing shape count in a future post.



  • Visio Insights

    Building Shapes the Easy Way


    Shape design is somewhat of an art in Visio.  There are so many things that go into creating professional-looking content that a certain level of expertise is required.  One of the goals of the Visio Insights blog is to provide that expertise in an understandable format.  Another goal is to demonstrate best practices to help you use Visio in the most effective manner.  This week we will demonstrate shape construction techniques by  creating a new shape from scratch.


    Our example is a digital clock shape.  The numerals in the clock – the digits – are drawn in geometry instead of text.  This allows us to be more creative with the appearance of the digits.  We want the digit to appear as it is shown in a Liquid Crystal Display.



    Today’s post focuses on ways to use the power of Visio to create shape geometry.  There are several approaches to constructing geometry.  You can use Visio’s drawing tools to manually draw the lines and arcs needed for the shape.  This works well for simple geometry, but the tools are not suitable for complex geometries.  You can also build geometry using the Shapesheet window by entering the actual formulas in the Geometry sections.  This approach is very precise but can be extremely slow and difficult to get things right.  A third approach is to build a complex shape by assembling it from simpler pieces.  This is the simplest approach because it makes Visio do the heavy lifting to create the final geometry.


    Let’s construct a shape to represent a digit for our clock using this assembly approach.  A digit is composed of seven individual polygons, which are shown or hidden to generate each possible numeral.  These polygons have tiny gaps separating them.  Also a slight rounding is applied for aesthetics.  We start by drawing a rectangle 1/2 in. wide by 1 in. tall.  Then we use the Offset command found in the Shape > Operations menu to create two additional rectangles 1/16 in. away from the original shape.  The outermost rectangle is not needed, so it is deleted.  We select the remaining two rectangles and use the Subtract command from the Shape > Operations menu to create a single shape with its middle removed.



    The crossbar is added by drawing a rectangle 1/2 in. wide by 1/16 in. tall and positioning it in the center of the existing shape.  A composite shape is created by selecting both shapes and choosing the Union command from Shape > Operations.  Note that commands such as Union and Subtract destroy the selected shapes and generate a brand new shape with the composite geometry.  For this reason, you should create the geometry of a shape before moving on to other aspects like formatting or behavior.



    Next we need to segment the shape into seven pieces with small gaps in between.  We draw lines in the places where we want the gaps to be located.  The lines extend beyond the shape geometry to facilitate the next shape operation.  Getting the lines in exactly the right place may require zooming in very close.  Otherwise Visio’s snapping behavior may prevent you from placing your cursor where you want it.  Once all the lines are drawn they need to be selected.  This is accomplished by selected all the shapes and then Shift+clicking on the digit shape to deselect it.  Then the Offset command is run with a spacing of 0.015 in.



    The offset lines serve as break points where the underlying digit shape must be segmented.  The segmenting is done using the Fragment command in Shape > Operations.  This command uses all the selected geometry to define simple closed polygons.  We can apply a green fill to the resulting shapes to better see them.  The inside squares are deleted first.  Then the tiny corner polygons are deleted, leaving only the seven segments for our digit.



    We now have seven individual shapes that make up our digit.  By selecting the shapes and choosing the Combine command in Shape > Operations, the seven shapes are converted into a single shape containing seven geometry sections.  This is a much more compact representation of the digit - decreasing file size and improving performance.  Corner rounding of 0.02 in is applied to the shape as a final touch.



    While there were several steps to get to the end result, we never had to do any complicated drawing or Shapesheet formula entry to construct this shape.  Two rectangles were drawn for the basic digit outline.  Then eight lines were drawn to define break points for the segments.  Visio’s shape operation commands did the rest of the work.  In the next post, we’ll add some smarts to this digit shape and use it to build up our digital clock.



  • Visio Insights

    Error #318 Explained


    Every once in a while we hear from a user who has encountered a cryptic error message in Visio and is left helpless.  Most of Visio’s error messages are somewhat explanatory, though we continue to improve their wording.  However, there is another set of messages that report “internal errors”. 


    Internal errors are usually problems where the Visio program has done something wrong, whereas other errors are shown in response to things the user has done.  Internal errors can be identified by an error number included within the message text.  Often the message provides no clue as to the problem or possible remedies.  We’ll look at one of the more frequently encountered internal error messages in this post – Error #318.


    Error #318 can occur when you copy and paste a shape from one document to another.  There are some specific circumstances needed to trigger the error:

    • The shape is an instance of a master
    • The shape has a reference to a cell in the Document Shapesheet
    • The cell in the Document Shapesheet has a reference to another cell in the Document Shapesheet
    • The Document Shapesheet cells are not present in the target document

    This is not the only way to encounter this error, but it is representative of what can happen.  Here are the steps to reproduce the problem:


    • Create a new blank Visio drawing
    • Open the Drawing Explorer from the View menu
    • Open the Document Shapesheet by right-clicking on the top item in the explorer
    • Create two rows in the User-defined section named Test1 and Test2
    • For the value of User.Test1, enter =User.Test2
    • Close the Document Shapesheet window



    • Right-click on the Masters item in the Drawing Explorer and choose New Master
    • Enter the name Test for the master and click OK
    • Edit the Test master and draw a rectangle
    • Open the Shapesheet for the rectangle and create a row in the User-defined section name Test
    • For the value of User.Test enter =TheDoc!User.Test1
    • Close the Shapesheet and master edit windows and accept changes


    • Go File > Shapes > Show Document Stencil
    • Drag and drop the Test master onto the page
    • Copy and Paste the shape into a new blank document

    The problem for Visio is the secondary reference in the Document Shapesheet to another cell.  Normally when a shape moves between documents, Visio automatically copies over the page and document cells that the shape depends on – creating them if necessary.  Visio sees that the shape being copied has a reference to cell User.Test1 in the Document Shapesheet, and it creates this cell in the target document.  Visio does not know that the contents of cell User.Test1 themselves have a reference to another cell.  Cell User.Test2 is not created in the target document.  When Visio tries to complete the Paste operation and recalculates the cells, it finds that there is a missing reference.  Error #318 is shown and the Paste operation fails.


    Unfortunately this is no simple bug in Visio but a significant architectural limitation, which means that a fix for the problem is not forthcoming.  However, by understanding how this error can occur we can identify some remedies.  In order for the Paste operation to succeed, the target document must have the correct set of Document Shapesheet cells in place.  It is certainly possible to add the required cells prior to doing the Paste.  Another option is to make sure the shape has a direct reference to each of the Document Shapesheet cells itself.  This might be a solution for shape and solution designers to use so that their users don’t experience strange Copy / Paste failures.


    If you encounter internal Visio errors, please tell us about it.  We’ll try to explain a few other common ones in a future post.



  • Visio Insights

    Going Around the Block


    In a previous post, we mentioned that Visio 2003 introduced a shape rotation handle to quickly allow rotation of shapes.  This eliminated the need to switch to a dedicated rotation tool.  You can rotate a shape by selecting it and dragging the rotation handle around to a new position.


    One of the more subtle behaviors of rotation is the way Visio snaps the shape to particular rotation angles.  The degree of fine control over the rotation angle varies with  the distance of the cursor from the shape.  This means that dragging the rotation handle in a wide, sweeping arc lets you precisely control the angle of the shape.  Dragging the rotation handle in a small, tight circle lets you rotate to just a few angular positions.  The status bar provides feedback on the current angle and snap increment.


    Visio defines snapping zones around each shape to determine what rotational snap angle to use.  The farther your cursor is from the rotation pin, the smaller the snap angle will be.  There is no need to try to keep your cursor directly on top of the rotation handle while you are rotating.  The rotation handle and snap angles work for single shapes and selections of multiple shapes.


    There is one additional feature related to the rotation handle.  Once you place your cursor over the rotation handle, the Center of Rotation pin is displayed for the shape.  This pin is usually in the center of the shape, and it designates the point that rotation revolves about.  It is possible to drag this pin to a new position inside or outside the shape.  Try it to see how this affects the way that the shape rotates.  This is especially useful when multiple shapes are selected.



  • Visio Insights

    Visio File Formats


    Visio has been around for over 15 years, and there have been many product versions released.  One of the biggest issues that can impact users from release to release is a file format change.  Changes in Visio's file format can be painful for customers because people must often share documents with others who are using a different version of the product.  Let's look at this issue in depth.


    Until recently Visio changed its file format with every major release.  This change was not as painful for customers as it is today because most people exchanged drawings within a much smaller circle of users - usually others in the same department who would have the same version of Visio installed.  As Visio gained more customers and those customers shared their drawings with other groups, version incompatibility became more commonplace.


    Visio file format history

    Product version

    Default file format

    Backward save format

    Visio 1.0



    Visio 2.0



    Visio 3.0



    Visio 4.0, Visio 4.1, Visio 4.5


    2.0, 3.0

    Visio 5.0, Visio 5.0 Plus



    Visio 2000, Visio 2002



    Visio 2003, Visio 2007




    Visio 2002 was the first major release to maintain the same file format as the previous release.  Visio 2003 once again introduced a new file format.  Visio 2007 will use the same format as Visio 2003.  Every version of Visio is capable of reading all older files.  Visio 2007 can open a Visio 1.0 document.  Generally, each version of Visio is capable of writing back one file version as well.  Thus Visio 2003 can save a file out in 6.0 format (readable by Visio 2000 and Visio 2002), but it cannot save out a 5.0 format or earlier.  When saving to an older format, some features and information may be lost if the older Visio does not support those features.


    Why change the file format?  To add features and new capabilities.  Visio 2000 introduced a new file format to allow vastly larger and more complex diagrams to be created.  Internal limits on the number of shapes and other items were removed.  The most recent change for Visio 2003 was required to introduce Unicode text throughout the application, though we took advantage of the change to build in some other great features as well.


    Will the file format change again in the future?  It might, but Visio must be mindful of the problems a change can cause for customers.  Word, Excel and PowerPoint have a new file format in Office 2007.  One of the things Microsoft is doing to make this transition go more smoothly is to release a compatibility update to Office 2000, XP and 2003.  Those versions can then read and write the new format.  Perhaps Visio should consider this approach.


    In the meantime, how do you deal with file incompatibilities?  The first option is to have the document author save the drawing as an older file version.  A second option is for the document author to publish the drawing using the Save As Web Page feature.  If you have received a document that was created in a newer version, you can also download the free Visio Viewer to at least view and print the document.  File incompatibility can be frustrating, but hopefully you now know what versions of Visio work with each format.



  • Visio Insights

    ScreenTips to HTML


    Today is a holiday in the US, so we're republishing this topic from a newsgroup post not too long ago.

    You can add the User.visEquivTitle cell to your shape and provide a string
    that will display as a tooltip in HTML web output.  The shape must also have
    at least one custom property for the tooltip to be visible.

    1) Select the shape in your drawing that you want to add a web tooltip for
    2) Go to Window > Show Shapesheet
    3) Go to Insert > Section, check User-defined cells and click OK
    4) In the newly created section, click on the row name User.Row_1 to select
    the title of the row
    5) Type visEquivTitle and press Enter - you should now see
    User.visEquivTitle for the row
    6) In the Value cell of that row, enter the text you want to display
    surrounded by quotes (e.g. "Hello World")
    7) If you instead want to display the same tooltip as the Shape ScreenTip
    enter  =Comment    (no quotes)
    8) Go to Insert > Section, check Custom properties and click OK
    9) You can fill in the custom property Label and Value if you want this
    information to be visible
    10) If you don't want the custom property to be visible, enter TRUE in the
    Invisible cell
    11) Close the Shapesheet window and repeat for any other shape you like
    12) Choose File > Save as Web Page to create the HTML output

    As you can see this is a bit involved.  The capability was designed more as
    a developer feature than an end user feature.  We recommend tying the Shape
    ScreenTip to the User cell so that you see the same tooltip in both Visio
    and the web output.  It should also be possible to use Macro Recorder to
    automate these steps.  If your shape has a custom property but does not have
    the User.visEquivTitle cell, Visio will display the shape's text in a
    tooltip instead.


  • Visio Insights

    Getting to Know Your Neighbors - Quickly


    Visio's SpatialNeighbors property is useful for finding shapes that are nearby other shapes or that overlap other shapes.  It can be used to programmatically answer the question "What did I drop my shape on top of?".


    Unfortunately, the SpatialNeighbors property can be extremely slow under certain circumstances.  In real world scenarios, searching might take anywhere from a second to over a minute.  That's unacceptable for developers who need to make frequent calls to the method.  Two factors can significantly alter the performance of the method.


    First, searching group shapes is much slower than searching non-group shapes.  This has to do with the way that SpatialNeighbors defines containment.  Shape A is contained within Group Shape B if A is contained within the union of all the sub-shapes of B.  Thus a lot of work is done to calculate that union before any relationship determination is made.  It may not be possible to eliminate groups, but it is always helpful to performance to minimize the number of sub-shapes as much as possible.  Also make sure to avoid nested groups.  Opt instead for of a single group shape with many sub-shapes.  Reducing the number of groups or shapes within groups can double or triple the performance of SpatialNeighbors.


    That's a decent improvement, but the second factor is even more important for performance.  With each call to SpatialNeighbors, the developer must specify the Relation types they wish to detect.  The four relation types are ContainedIn, Contain, Overlap and Touching.  Any combination of types can be searched for.  The problem is that Visio checks for each of these relationships individually and must redo all the analysis work described above every time.  This leads to astronomic execution times.


    The workaround here is to not specify the relation type at all.  When passing in 0 for the Relation parameter, Visio makes several internal optimizations because it no longer cares about the particular way in which two shapes are related.  For developers who don't care about the relation type, passing in 0 is a couple orders of magnitude faster (100x) than passing in all the types.  For those that really do need to find the shapes matching a particular relationship, call SpatialNeighbors passing in 0 to get a collection of candidate shapes.  Then iterate through the collection and use the SpatialRelation property to get the relationship.  This technique uses the really fast searching code to weed out all the shapes that are completely unrelated.  The expensive code to determine actual relationships is then used with a much smaller set of shapes.



  • Visio Insights

    Going Off the Page


    In an ideal world every business process would each fit on a single page.  Users have employed a variety of techniques to squeeze more information into a finite space.  Ultimately some business process diagrams must span across more than one page.  To maintain connectivity between the pages, Visio provides the Off-page reference shape.



    The Off-page reference shape can be found in the Basic Flowchart Shapes stencil that opens with flowchart diagrams.  It works like any other flowchart shape.  You can connect it to other shapes and add text or formatting.  When the Off-page reference is dropped on the page, a dialog box appears asking where the shape should link.



    By default a new page will be created, and a copy of the Off-page reference shape will be added to that page.  The two shapes are linked to each other via hyperlink and as well as double-click.  There is also an option for synchronizing the text between the shapes.


    However, this behavior is not limited to the Off-page reference shape.  The functionality behind the shape is provided by the Off-Page Connector (OPC) add-on.  Your shapes can offer the same linking capability by adding a few calls to this add-on.  Put the following formulas into these cells in the Events section of the Shapesheet for your shape.









    The EventDrop cell is triggered when the shape is dropped on a page.  /CMD=1 tells the Off-Page Connector add-on to show the Off-page reference dialog.  Clicking OK in the dialog will cause the add-on to insert the necessary tracking and linking information into your shape.  EventDblClick is the trigger for double-clicking on the shape.  TheText is the trigger for shape text changes.


    There is a bonus feature in the Off-Page Connector add-on that is not exposed by the Off-page reference shape.  It is possible to link to separate documents in addition to other pages in the same document.  Use these formulas to trigger the Off-document reference.







    When an Off-document reference is triggered, the Off-document reference dialog appears asking what document and page to link to.  Once the link is established, double-clicking or activating the hyperlink will take you to the other document.  Visio will open the other document if it is not opened already.  Note that text synchronization is not provided across documents.



    The Off-Page Connector add-on is available in both Visio Standard and Professional editions, so your custom reference shapes will work with any installation.  If you use the Off-page reference shape or create diagrams that span across pages, please tell us about it.  We would like to hear what types of drawings you work with and how you set up the links.


  • Visio Insights

    Cutting Corners


    One of the challenges in Visio shape design is striking a balance between custom behavior and standard behavior.  The shape designer has one notion about how a shape should be used, and users often have a different notion.  Ideally the shape designer allows as much flexibility as possible without destroying the meaning of their shape.


    Let’s look at an example.  Suppose the designer wants to create a speech balloon shape.



    The essential part of this shape is the triangle underneath the shape, which implies that the balloon contents come from a speaker.  The shape designer draws the balloon outline and discovers during testing that corner rounding does not work with the shape.



    One way to fix this is to prevent corner rounding on the shape (by setting the Rounding cell to =GUARD(0) ) .  However, this frustrates users who expect corner rounding to work.  Disabling corner rounding for the entire shape is too restrictive.  Users should be able to use corner rounding without changing the original meaning of the shape. 



    In this case the shape designer can improve their shape’s behavior with just a few extra steps.  The trick is to understand that Visio can only draw a rounded corner at vertices where there is sufficient room to do so.  If two vertices are too close, the rounded segment between them will be smaller.  In fact, by putting two vertices on top of each other you can eliminate the rounded corner entirely.



    The image above shows the Shapesheet for the original balloon shape.  The first three geometry rows define the speech triangle.  By inserting new geometry rows with the same vertices, no corner rounding will appear for the speech triangle.  You add a row by right-clicking and choosing Insert Row After.  Here is the updated geometry section:



    Now corner rounding works beautifully.  There are additional things to consider in this speech balloon example such as the resize behavior, text block position and alignment box size.  This post simply illustrates the need for shape designers to be aware of the ways their design restricts shape behavior.  Then they can look for solutions that give users the behavior they expect from any Visio shape.



  • Visio Insights

    After Further Review


    Several users have encountered a situation in Visio 2003 where the Reviewing toolbar is always shown.  Even once you turn off the toolbar, it reappears the next time the document is opened or the next time the Visio application is launched. 



    Here are some possible explanations and remedies.  You may need to try multiple remedies to keep the Reviewing toolbar from popping up again.


    1)      The current document is in Track Markup mode.  Go to the Tools menu and turn off Track Markup mode.  Then resave the document.

    2)      Visio is set to display Markup in the document.  Go to the View menu and turn off Markup.  Then resave the document.

    3)      The Reviewing toolbar was visible when Visio was last exited.  Go to View > Toolbars to turn off the Reviewing toolbar.  Then exit Visio and restart.


    Are there other behaviors in Visio that you find frustrating?  Please let us know.


  • Visio Insights

    How It All Began


    We're going to wrap up our look at Visio's essential features with the most significant innovation of all - the SHAPE.


    Essential Feature: Shapes

    A central concept in Visio is assembling a diagram from a pre-packaged set of content.  Users do not need to construct drawings from scratch using geometric primitives, nor do they need to be artists to draw great-looking symbols.  You only have to find a shape in one of Visio's stencils and drag it into the drawing.


    Visio shapes differ from Clip-Art in three important ways:


    ·         Shapes are vector-based graphics meaning that they size and scale well (yes, some Clip-Art is vector-based too).

    ·         Shapes can have behaviors that control their appearance or interactivity with the user. 

    ·         Users can customize shapes or build new ones from scratch to easily create new content. 


    We refer to Visio's content as SmartShapes because they react in an intelligent manner when you manipulate them in a diagram.


    There are many, many things to say about designing and using shapes in Visio, but for now let's look at one shape in particular.  Looking back at the history of Visio, you could say it all began with a single SmartShape - the block arrow.



    If you want to see an example of this shape in the current product, open the Basic Shapes template (File > New > Block Diagram > Basic Diagram) and drag out the 45 degree single shape from the Basic Shapes stencil.  There are two special behaviors on this shape.  First, you can stretch the width of the arrow without affecting the size of the arrowhead.  Second, you can control the size of the arrowhead by changing the height of the shape.  These behaviors preserve the 45 degree angle of the arrowhead across a wide range of shape sizes.



    Compare this resize behavior to a standard symbol.  Every arrowhead has a different angle.



    How does this work?  Every Visio shape is actually a collection of properties that are defined using parametric expressions.  Unlike many objects that have properties with static values, a Visio shape has properties with either a static value or a dynamic value that is calculated from a formula.  Other shape properties are often used as parameters in the formula, and that gives the shape its behavior.  For example, I can make a rectangle whose Width property is a function of Height.  If I set Width = Height * 2, then I have made a behavior that changes the Width automatically whenever the user adjusts the Height of the shape.


    Visio shapes have hundreds of properties, each of which can have a formula.  These properties are organized into a spreadsheet interface called the ShapeSheet.  Just as in a spreadsheet, the properties are called Cells in the ShapeSheet.  Cells are organized into rows, columns and sections.  See for yourself.  Select the arrow shape on the page and choose Window > Show ShapeSheet from the menu.  The ShapeSheet Window opens, showing you the real power behind shapes.



    If you look at the ShapeSheet for the 45 degree single arrow shape, you can see some of the parametric formulas that give this shape its special behaviors.  The 1-D Endpoints section tracks the current begin and end points of the arrow.  The Shape Transform section has formulas that depend on the endpoints.  For example, the Width of the shape uses the Pythagorean theorem to compute its value from the endpoints.


    The Geometry section lists the points that make up the line segments you see on the screen.  If you tile the drawing window and ShapeSheet window together (Window > Tile), you can select a cell in the Geometry section and Visio will highlight that point on the arrow in the drawing window.  Notice that all these points are expressed in terms of Width and Height and also a pair of Scratch cells.  The smarts behind this arrow shape are found in the Scratch.X1 cell.  This cell has a formula that determines the correct size of the arrowhead in order to maintain a 45 degree angle.


    One of the best ways to learn how to make shapes is to look at the ShapeSheets of existing Visio shapes.  You can see the formulas those shapes use.  You may just need to customize an existing shape slightly to make the SmartShape you want.  There are thousands of shapes that ship with Visio.  Or you may want to make a shape from scratch incorporating behaviors you discovered in other shapes.  The ShapeSheet is a powerful tool that Visio exposes to all users so that they can create shapes that have the visual appearance users need and behaviors that make diagramming with them easy.


  • Visio Insights

    Intelligent Diagrams


    This is the sixth topic in a series discussing the essential features that make up the Visio application.


    Essential Feature:  Extensibility

    Part of the original vision for Visio was that you could use it to make almost any kind of drawing.  Rather than focus on being just a flowcharting application or just a floor plans application, Visio chose to be a general purpose diagramming and drawing application.  The features built into the product covered the basics of working with shapes on a page.


    However, the Visio architects determined that it would be quite useful for specific types of diagrams to have more specialized behavior.  Developers can supplement the generic diagramming experience with functionality that is tailored to the drawing type, making Visio a great Organization Chart application and a great HVAC ductwork application and a great Database Modeling application. 


    One of the interesting aspects of Visio's extensibility story is that the shipping product itself contains over one hundred add-ons to the core drawing engine that utilize the automation interface.  These add-ons range from simple utilities like the Area & Perimeter add-on to the robust behaviors in Organization Charts or UML diagrams.  Many of the features people use every day in Visio are not general features of Visio but are actually capabilities provided by add-ons.  One of the great benefits of using the Visio API for our own features is that it is well-tested before any Visio product goes out the door.


    The real power in Visio extensibility story though is the breadth of automation options available to developers.  Here are some of the more common ways to build on the Visio platform:


    Extensibility Mechanism


    Visio Add-on

    Special C++ dynamic link library

    COM Add-in

    Standard extensibility interface across Microsoft Office.  These may be developed in any programming language that supports COM Automation as well as any managed language.


    Visual Basic for Applications built into the Visio product

    Visio Drawing Control

    ActiveX control for inserting a Visio surface into your application

    XML File Format

    Full fidelity file format for Visio documents in XML structure

    Custom Shapes and Stencils

    User-created content with powerful set of custom behaviors possible


    The Visio drawing platform gets richer with each release, and fortunately there is a great resource to cover it all.  The Visio SDK was initially released with Visio 2002 and has been updated for Visio 2003 and the upcoming Visio 2007 as well.  It's available free on MSDN for download.  There is a lot to learn and take advantage of with Visio extensibility.  Look for more posts on this topic in the future.


Page 7 of 8 (181 items) «45678