Visio Insights
The official blog of the Microsoft Visio product team

  • Visio Insights

    Announcing SharePoint 2010 and Visio Services


    Yesterday Microsoft released details about SharePoint 2010 at the SharePoint Conference in Las Vegas.  SharePoint 2010 is a major release, covering a tremendous array of collaboration capabilities.  You can read the overview on the SharePoint team blog.  A notable feature in SharePoint 2010 is Visio Services.  Here is the summary of Visio Services from our original description of the Visio 2010 release:

    Visio 2010 can take data-refreshable diagrams and publish them to SharePoint for broad distribution to anyone with a web browser. Visio Services performs data refresh and rendering on the server and delivers up-to-date diagrams in the browser. The diagram author no longer needs to repost the diagram every time the data changes, and diagram viewers no longer need the Visio client to see the diagram.


    Beyond simply viewing the latest version of a diagram in the browser, Visio Services enables interactive dashboards or mash-ups.  You can show a Visio diagram in a web part and define interactions between the diagram and other web parts on a page.  For example, in the image above, selecting a computer shape in the diagram will display detailed information about that computer on the right side.  Additionally, choosing one of the radio buttons on the right side will select the shapes in the diagram that match that criteria.

    The Visio team is showing Visio Services in depth at the SharePoint Conference this week.  Initial feedback from the conference attendees has been quite positive.  We’ll have a lot more Visio Services information to share on the blog next week, but there are other ways that Visio integrates with SharePoint 2010.  Coming up this week we look at one example.

  • Visio Insights

    The Visio 2010 Connectivity API


    Our previous post on AutoConnect in Visio 2010 discussed how Visio 2010 makes it simpler and faster for end users to create connected diagrams such as flowcharts. Many developers will be pleased to hear that Visio 2010 also brings greatly simplified utilities for working with connected diagrams programmatically. The Visio 2010 API contains new methods that let developers manipulate and traverse connected diagrams or graphs at a higher level of abstraction than previously, which can result in greater programmer productivity and more concise, readable code.

    In this blog post, we will introduce the new Visio 2010 methods used for working with connected diagrams. Then we will see these methods in action by doing a visual walk-through of a program that manipulates a flowchart. (The source code and diagram used below are also available for download here.)

    New connectivity methods in Visio 2010

    For each of the following API methods, we give a brief description on what the method does, along with an explanation of the method’s arguments. This is not meant to be a complete reference; the forthcoming Visio 2010 SDK will contain much more complete documentation on these methods.

    Shape.ConnectedShapes(Flags, CategoryFilter)

    Returns an array of identifiers (IDs) of shapes that are one degree of separation away from the given shape (i.e. separated by a 1-D connector).


    • Flags: Filters the list of returned shape IDs by the directionality of the connectors.
    • CategoryFilter: Filters the list of returned shape IDs by limiting it to IDs of shapes that match the specified category. A shape’s categories can be found in the User.msvShapeCategories cell of its ShapeSheet.

    Shape.GluedShapes(Flags, CategoryFilter, pOtherConnectedShape)

    Returns an array of identifiers for the shapes that are glued to a shape. For instance, if the given shape is a 2-D shape that has multiple connectors attached to it, this method would return the IDs of those connectors. If the given shape is a connector, this method would return the IDs of the shapes to which its ends are glued.


    • Flags: Specifies dimensionality and directionality of connectors of shapes returned.
    • CategoryFilter: Specifies category of shapes returned.
    • pOtherConnectedShape: Optional additional shape to which returned shapes must also be glued

    Page.DropConnected(ObjectToDrop, TargetShape, PlacementDir, [Connector])

    Creates a new Shape object on the page, places the new shape relative to the specified existing target shape, and adds a connector from the existing shape to the new shape. Returns the newly created shape. This feature parallels the AutoConnect feature in the Visio user interface.


    • ObjectToDrop: The shape to be added to the page
    • TargetShape: The existing shape from which to align, space, and connect
    • PlacementDir: The direction from TargetShape in which to place ObjectToDrop
    • Connector: The connector to use (optional). This overrides usage of the default Dynamic Connector.

    Page.SplitConnector(ConnectorToSplit, Shape)

    Splits the specified connector with the specified shape. Returns the new, duplicated connector.


    • ConnectorToSplit: The connector to split. Must be a routable 1-D connector.
    • Shape: The shape to use to split the connector. Must be a 2-D shape.

    Shape.Disconnect(ConnectorEnd, OffsetX, OffsetY, Units)

    Unglues the specified connector end points and offsets them the specified amount from the shapes they were joined to.


    • ConnectorEnd: The end of the connector to disconnect
    • OffsetX: The x-distance that the connector end is moved away from the shape
    • OffsetY: The y-distance that the connector end is moved away from the shape
    • Units: The units of measure for the assigned offset values

    Page.AutoConnectMany(FromShapeIDs(), ToShapeIDs(), PlacementDirs(), [Connector])

    Automatically draws multiple connections in the specified directions between the specified shapes. Returns the number of shapes connected.


    • FromShapeIDs(): An array of identifers of the shapes from which to draw a connection
    • ToShapeIDs(): An array of identifers of the shapes to which to draw a connection
    • PlacementDirs(): An array of constants that represent the directions in which to draw the connection
    • Connector: The connector to use (optional). This overrides usage of the default Dynamic Connector.

    Let’s try it out!

    Here is a screenshot of a Visio drawing we will be manipulating and traversing:


    Using a few of the above listed methods, we’ll add to this flowchart and traverse it. Each step along the way, we’ll show you the corresponding line of C# code along with a screenshot of the change it caused.

    Note: In the below code snippets, page refers to the active drawing page, and the Visio namespace is an abbreviation of Microsoft.Office.Interop.Visio. The meanings of most other variables should be apparent from the context.

    First, let's split the connector that currently connects "Start Event" to "Task" and insert a Sub-Process shape. We can access that connector using the GluedShapes method. Once we’ve accessed the connector, we use SplitConnector to split it.

    Array shapesGluedToStartEvent =
        startEvent.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesOutgoing1D, "", null);
    // In this example, the above array has 1 element. Let's get that element.
    int splittableConnectorID = (int)shapesGluedToStartEvent.GetValue(0);
    Visio.Shape splittableConnector = page.Shapes.get_ItemFromID(splittableConnectorID);
    page.SplitConnector(splittableConnector, subprocessMaster);

    This yields the following result:


    Let's say we want to programmatically access the "Task" shape. If we have a reference to "Start Event", we can access "Task" by traversing across "Sub-Process", using ConnectedShapes.

    Array shapesConnectedToByStartEvent =
        startEvent.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesOutgoingNodes, "");
    // In this example, the above array has 1 element. Let's get that element.
    int subProcessID = (int)shapesConnectedToByStartEvent.GetValue(0);
    Visio.Shape subProcess = page.Shapes.get_ItemFromID(subProcessID);

    // Repeating the same action as above to get from "Sub-Process" to "Task".
    Array shapesConnectedToBySubProcess =
        subProcess.ConnectedShapes(Visio.VisConnectedShapesFlags.visConnectedShapesOutgoingNodes, "");
    int taskID = (int)shapesConnectedToBySubProcess.GetValue(0);
    Visio.Shape task = page.Shapes.get_ItemFromID(taskID);

    Now let's use DropConnected to drop an End Event shape onto the page and have "Task" connect to it. We use the default connector, so the last argument can be null.

    Visio.Shape endEvent = page.DropConnected(endEventMaster,

    This yields the following result:


    We hope this walk-through was a helpful illustration of Visio 2010’s new API utilities for working with connected diagrams. This article covers only a small part of the enhancements made to Visio’s API for the 2010 release; more information will come in future posts on this blog, and with the release of the Visio 2010 SDK.

    We’re interested to hear what developers think of this API functionality, so please use the Send a Smile feedback tool or leave a comment below.

  • Visio Insights

    BPMN Diagramming Basics Course Available


    A new series of training videos have been posted on to introduce Visio users to Business Process Modeling Notation (BPMN).  The videos are packaged as a course named BPMN Diagramming Basics.


    The course provides both an introduction to the BPMN notation and a tutorial on creating BPMN diagrams with Visio 2010 Premium.  Along the way you can see some of the other new features of Visio 2010 including Swimlanes, AutoConnect, Subprocesses, and Diagram Validation.  The complete course takes less than 30 minutes to view.

    Please remember that the BPMN, Subprocess, and Diagram Validation features are part of the Premium Edition of Visio 2010.

    Be sure to let us know what you think!

  • Visio Insights

    Improved Flowchart Routing in Visio 2010


    When creating and maintaining flowcharts, a pain point users suffer from is ensuring that the connectors between shapes look good. Visio introduced the dynamic connector many releases ago to help simplify diagram maintenance. Dynamic connectors in combination with dynamic glue allow Visio to choose the sides of shapes to glue your connectors for the best looking results.

    In Visio 2010 we made improvements to Visio's routing engine to address some common flowcharting pain points. (For more on the dynamic connector and why you should use dynamic glue, see this previous post titled "Gluing It All Together". )

    Improving Flowchart Readability

    Clarity is important in flowcharts. Overlapping connectors flowing in opposite directions can create ambiguity about the meaning of the diagram. It is easy to get into a situation where two connectors appear visually to be connected, but were not explicitly connected by the diagram author. Visio 2010's routing engine detects such ambiguous situations and relocates connectors to actively avoid them.

    Consider the example below where I draw two dynamic connectors: one from shape A to B and the other from B to C. In Visio 2007, this leads to an ambiguous drawing, where it appears as if shape A is connected to shape C. Visio 2010 moves the connector between A and B to an alternate side of shape B to resolve the ambiguity.

    incoming conflict

    We made this design change based on user feedback. It scales to handle more than just a few connectors, and allows connectors to overlap when they are flowing in the same direction.

    A consequence of this change is that if you open a diagram that was created in older versions of Visio in Visio 2010, as you edit your diagram, you may see connectors relocate to different sides of shapes. Note that Visio doesn't move glue points of connectors that are statically glued.

    Relaxing Constraints on Flowchart Direction

    Visio flowcharts that use the "Flowchart" routing style have a routing direction, like "Top to Bottom" or "Left to Right". In flowchart routing, this controls what sides of shapes dynamic connectors (mostly) connect to. Strict adherence to this direction can easily lead to situations where a dynamic connector takes a path around a shape with 5 segments.

    Using "Top to Bottom" as my routing direction, routes generally exit from the bottom of a shape and connect to the top of the shape, except in cases where shapes line up exactly.

    In Visio 2010, we enable dynamic connectors to connect to alternate sides of shapes when the shapes are close to each other.

    virtual overlap

    To strike a balance between having simple looking connectors and still adhering to the flowchart direction, Visio connects to non-standard sides of shapes when two shapes are close to each other in the axis of the routing direction.

    As always, we're interested in your feedback on routing, so use the Send a Smile feedback tool or comment on this post to let us know what you think.

  • Visio Insights

    Make Your Own Data Graphic – Data Bars


    This is the second post in a series demonstrating how you can create data graphic callout shapes for use in Visio 2007 Professional.  The first post discussed Text Callouts.  There is also an article on MSDN that covers the full spectrum of customization possibilities for Data Graphics.


    Data Bar example 


    A Data Bar is one of the four ways you can visualize data using Data Graphics.  It displays numeric data in a graphical form using the geometry of the callout shape to indicate the magnitude of the data value.  Data Bars may also display text and can even display multiple fields at once.  As with the other Data Graphics callouts, the visualization is as customized as you want to make it.

    In this post we are going to create the “slider” shape shown above.  This callout has two parts.  A long, thin bar shows the full range of possible data values, and a circle slides along the bar to indicate the current data value.  The circle also displays the current data value as text expressed as a percentage.  Let’s start with the bar and perform the minimum tasks necessary to create a Data Graphic callout.




    We draw a rectangle on the page and open its Shapesheet.  In the Shapesheet, we need to insert a User-defined section and a Shape Data section.  To make this shape a Data Graphic callout, first change the row name of the User-defined row to User.msvCalloutType (click on the row name and type "msvCalloutType").  In the Value cell enter "Data Bar" - including the quotation marks here.  Next change the row name of the Shape Data row to Prop.msvCalloutField (click on the row name and type "msvCalloutField").  Data Bars also have Shape Data rows for the minimum and maximum values that the callout field can have.  Add two more Shape Data rows named Prop.msvCalloutPropMin and Prop.msvCalloutPropMax.  Enter labels in the Label column and the word “Number” in the Prompt column as shown in the screenshot.

    Visio uses the User.msvCalloutType value to determine where to surface your custom callout shape in the Data Graphics user interface.  This shape will appear in the Callouts list in the New Data Bar / Edit Data Bar dialog.  Visio populates the Prop.msvCalloutField value (the Value cell in this row) with the data to display at the time the data graphic is applied to a shape on the page.  Visio also will fill in values for Min and Max based on the data recordset, and these are exposed in the Data Bar dialog as well.  This shape will now be treated as a Data Graphic callout if you drag it into the Document Stencil, but right now it doesn’t do anything with the data from Visio.  We need to build out the rest of the shape to make it work like a data bar.


    Label display

    Our rectangle will serve as the long, skinny part of the data bar - indicating the full range of field values.  It also is responsible for displaying the field label.  We want this label to be optionally hidden as is the case in the sample callout above.  Visio will place the field label in the Prop.msvCalloutField.SortKey cell (a strange place, yes, but the Label cell is already used for exposing properties in the Data Bar dialog).  Enter some default text such as “Label” (including quotation marks) in this cell.  Then select the rectangle in the drawing window and choose Insert > Field.  Choose Custom Formula and then enter the formula: “=Prop.msvCalloutField.SortKey” (no quotation marks) and press OK.  We want the label to be outside the rectangle on the right side.  In the Shapesheet insert a Text Transform section and fill it out as shown below:




    We want the user to be able to choose whether the field label is shown or hidden.  Data Graphics allows us to create our own callout property to display in the Data Bar dialog.  Add a new Shape Data row and name it Prop.msvCalloutPropShowLabel.  The row name must include the prefix “msvCalloutProp” to be recognized as a callout property.  Then place a human-readable name in the Label column and the word “Bool” in the Prompt column.  The Label value appears in the dialog as the name of the property.  The Prompt value tells Data Graphics what type of control to use in the dialog – in this case a simple True / False dropdown.  Visio will put the user’s choice in the Value cell.  Go ahead and enter the default value True here.  A full explanation of the syntax for custom callout properties is included in the MSDN article.  Finally tie the visibility of the shape’s text to this Value cell by entering this formula in the HideText cell:  “=NOT(Prop.msvCalloutPropShowLabel)”.




    Data bar value

    Next we will create the circle shape that represents the current value for the data bar.  The rectangle and circle together form the callout shape, so we need to make a group.  Select the rectangle shape and choose Shape > Grouping > Convert to Group to make this the top-level group shape.  In the rectangle’s Shapesheet set the LockCalcWH cell to 1 so that further grouping operations do not change the shape’s size.  Also set the DisplayMode cell to 1 so that the rectangle will appear behind its subshapes.  Now draw a circle on the page.  Select the rectangle, then Ctrl-click on the circle to select it as well.  Choose Shape > Grouping > Add to Group to make the circle a subshape of the rectangle.




    The position of the circle is dependent on the current field value and its relative size versus the Min and Max values.  We’ll add a User-defined cell to the rectangle shape to calculate the percentage of the total range.  In the rectangle’s Shapesheet add a User-defined row named User.PercentFilled and enter this formula:


    This expression calculates the current percentage of the field value between Min and Max.  It also prevents division by zero and checks to make sure that the result stays between 0 and 1 so that our data bar behaves predictably.




    Value display

    The User.PercentFilled value will be used by the circle subshape to control its position and to display the value as text.  We’ll start with the value display.  In the circle’s Shapesheet insert a User-defined section and add a User.PercentFilled row that references the value from the rectangle.  Since we will use this value multiple times, it is good practice to use a single cross-sheet reference and then multiple local cell references.  (Note that your sheet ID’s may be different than those shown here.)




    Now select the circle in the drawing window and choose Insert > Field.  Choose User-defined Cells and select the PercentFilled cell.  Before closing the dialog click on the Data Format button.  Choose Percentage and 0 decimal places.  Then click OK twice.  Next we want to tie the size of the circle to the size of the text so that the text always fits.  Add another User-defined row named User.CircleDiameter to track the size of the circle.  Then add this expression for the value: “=CEILING(TEXTWIDTH(TheText),2 pt)”  (omit quotation marks).  This expression calculates the current width of the text and rounds it up to the nearest 2 pt to get rid of tiny variations in text width based on proportional character spacing.  We add formulas to the Width and Height cells of the circle to tie its size to User.CircleDiameter.  The formulas are GUARDed to prevent accidental resizes by the user.  Set the NoObjHandles cell to 1 to hide the resize handles since they are not needed.




    Value position

    We’re ready to tie the position of the circle to User.PercentFilled.  The circle should move from one end of the rectangle to the other.  We must account for the circle diameter when calculating the range of movement so that the circle does not move overlap the ends of the rectangle.  Add this formula to the PinX cell:


    Also set the PinY cell:  “GUARD(Sheet.1!Height*0.5)”.




    Finishing touches

    Our callout is now functional enough to test.  Open the rectangle’s Shapesheet and enter sample values for Prop.msvCalloutField as well as the Min and Max properties.  You should see the circle move and display the proper value as text.  The only remaining work is to enhance the appearance of the data bar.  The rectangle height should be a fraction of the circle diameter.  Actually, the height of the rectangle shape should encompass both the rectangle and the circle, so we’ll just make the geometry of the rectangle shape smaller.  Add a User-defined row named User.CircleDiameter to the rectangle and reference the circle’s User.CircleDiameter cell.  Then add a User-defined row named User.BarHeight and set it to be a fraction of the circle size.  The geometry of the rectangle is then modified to depend on User.BarHeight as shown in the screenshot below.




    The overall size of the callout should be fixed; the width is set to a constant value and the height is large enough to hold the circle.  Enter the formulas for Width and Height as shown in the image below.  Note that DropOnPageScale is a factor that adjusts the size in cases where a scale other than 1:1 is used in the drawing.  This is a good practice whenever hard-coding measurement values like the ones in these formulas.




    One final change is to set the LockFromGroupFormat cell to 1.  This prevents formatting changes applied to the main shape from propagating to the callout.  Generally we want the callout to retain its own formatting unless the user directly selects the shape and modifies it.  Our callout shape is complete.  The rest of the look is achieved through Themes.  Apply a color theme and effects theme to the page.  Our sample uses the “Office” color theme and “Button” effects theme, but the callout will pick up whatever theme is applied in your document.  Sub-select the circle shape and change the fill color to make it stand out from the rectangle.  Accent 2 is a good choice here.  The finished shape is below.




    Testing the callout

    To use this callout, we need to make it a master shape in the Document Stencil.  Go to File > Shapes > Show Document Stencil and then drag the shape in.  Rename the master to “Slider”.  Now we need to apply it to a shape.  Draw a text box on the page and type some text.  Then right-click on the shape and choose Data > Shape Data.  Answer Yes to define new shape data.  Add a Label, set the Type to Number and enter a sample Value before clicking OK.  Click OK once more to finish adding data to the text shape.




    Right-click the shape again and choose Data > Edit Data Graphic.  Choose New Item > Data Bar to open the New Data Bar dialog.  Choose “Rating” for the data field and make sure that our Slider master is selected as the callout.  Then turn off the label by setting Show Label to No.  Click OK twice to apply the data graphic.




    The final result is shown below.




    As you can see there are quite a few steps.  However, most of the work is creating the custom behavior and appearance you want.  The end result is quite professional and easily integrates into the Data Graphics feature.  In the next post we will create the final type of callout used in Data Graphics: the Icon Set.


  • 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

    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

    Visio 2010 Technical Beta program


    We’re excited to announce that the Visio team is taking nominations to participate in the Visio 2010 Technical Beta program! We will be sending out a limited number of invitations to download and install Visio 2010 Technical Preview in July. The team is excited to get valuable feedback and early testing from our community that will help us make this a great release. Here is your opportunity to nominate yourself to participate in the program (space is limited). If you’re interested, please go here to sign up for Microsoft Connect and apply to be part of the Technical Preview. When asked, select Visio as the application you’re most interested in testing (question 13 on the survey).

    We look forward to hearing from you.

    P.S. Visio MVPs are already nominated and need not apply.

  • Visio Insights

    Visio 2007 Service Pack 3 Available


    The Service Pack 3 (SP3) update for Visio 2007 is now available. It includes a variety of new security, stability and performance improvements as well as all previous updates and hotfixes released through August 2011. The SP releases are cumulative, so it is not necessary to apply any earlier service pack releases to get all previous updates.

    A number of issues that have been addressed in previous hotfixes are included in this SP. The most significant of these are:

    • Corrected an issue that caused fonts in to lose formatting in Organizational Charts when text was edited
    • Corrected an issue that caused Visio to crash when opening certain VDX drawings
    • Corrected an issue that caused Visio VBA projects to intermittently save incorrectly in Windows XP.

    A full list of addressed issues can be found at

    Fix for Bluetooth add-in crashes

    This service pack also addresses an issue involving Bluetooth add-ins which could cause recurring crashes in some machines running specific versions of a Bluetooth add-in. These add-ins are commonly installed by default on new laptops and PCs.

    If a Bluetooth “Send to Office” add-in is installed, Visio may crash at the start of a session, during copy/paste, or on exit. This crash is often frequent and persistent on affected computers and may prevent use of Visio.

    In order to correct this problem, Visio 2007 SP3 moves any Bluetooth add-in to the disabled add-ins list, and the add-in is not re-enabled in subsequent sessions. Once a Bluetooth add-in has been moved to the disabled add-ins list, the “Send to Office” functionality is disabled and no longer available. A disabled Bluetooth add-in can be re-enabled manually or manufacturers can override the disabling code during the installation to prevent the Bluetooth add-in from ever being disabled.

    Detailed instructions to re-enable or override this behavior can be found at

    SP3 Downloads

    The Visio SP3 and instructions for installation can be found at

    Thank you for your continued feedback on Visio. If you have additional comments for the product team, please add them below or e-mail us a message.

  • Visio Insights

    Working with ResizeMode


      In this post, we take a break from Visio 2007 information and explore a peculiar shape design issue.  If you have worked with Groups in Visio, you have probably encountered a situation where the shapes inside of a group just don't behave properly during resize.  Sometimes you want shapes inside a group to resize with the group.  Sometimes you don't.  Visio provides a setting to control the resize behavior, but you may be surprised how it works.  Enter ResizeMode.


      ResizeMode is the name of the Shapesheet cell that controls shape resize within groups.  This is presented as Resize Behavior in the Format > Behavior dialog.  There are three possible settings for the resize behavior: Scale with group, Reposition only and Use group's setting.


      Format > Behavior dialog 


      A shape inside a group will have one of these three settings.  Really there are just two behaviors (scale & reposition), with the third setting just deferring up to the group for its value.  The default setting is Use group, which in turn defaults to Scale.  So how does Scale and Reposition affect the resizing of shapes inside a group?


      Resize behaviors 


      Scale allows the shapes inside the group to stretch as the group stretches.  Reposition maintains the original size of the shapes but moves their center as the group stretches.  Sounds straightforward enough, so what's the catch?


      The catch is that ResizeMode only works when used BEFORE a shape is grouped.  When a shape is put into a group, Visio uses ResizeMode to determine what formulas get applied to the shape to make it resize with the group.  Changing ResizeMode later on has no effect on the resize behavior.  Thus it is quite likely that users change the setting and then get frustrated when nothing happens.  It's just not a good design.


      Here is the Shapesheet view of what is happening.  ResizeMode is a cell in the Shape Transform section.  The default is 0 (Use group's setting).  Reposition only is 1.  Scale with group is 2.  Below is the Shapesheet for a shape before it is grouped.




      Below is the Shapesheet of a shape with ResizeMode = 1 that is then grouped.  Notice that the Width and Height formulas are untouched, but the PinX and PinY depend on the group.  This is the Reposition behavior.


      Shapesheet - Reposition 


      Below is the Shapesheet of a shape with ResizeMode = 2 that is then grouped.  Notice that Width and Height now depend on the group.  This is the Scale behavior.


      Shapesheet - Resize 


      Changing ResizeMode in the Shapesheet and in the Format > Behavior dialog has no effect on these formulas.  The setting only comes into play at the time the shape is added to a group.  Visio has some work to do to clean up both the design and the documentation for ResizeMode.  Hopefully this article explains what is really happening.


  • Visio Insights

    Make Your Own Bubble Chart, part 1


    In the previous post we introduced the Bubble Chart diagram and demonstrated a quick way to create one using the BubbleChart.vss stencil.  This stencil was custom-built for the blog, so grab the file attachment from the previous post.  Now we build the stencil from scratch to understand how to integrate Visio 2007's Data Connectivity features with shape design.


    Bubble chart 


    There are two shapes in the BubbleChart.vss stencil: Bubble Chart and Bubble Data.  Bubble Chart is the background shape that defines all the parameters of the chart.  Bubble Data is the circle shape added for each row of data displayed.  There's a third player that is critical to making the bubble chart work without the need for code - the Page.  In this solution the Bubble Data shapes do not have to know anything about the Bubble Chart shape.  The page acts as the central property store for the chart, avoiding any messy configuration between the chart and the bubbles.


    First, we create the stencil.  Launch Visio and create a new blank page.  Then create a new blank stencil.  Right-click in the Shapes window and choose New Master.  Enter Bubble Chart and click OK.  Right-click again to create a new master shape called Bubble Data.  Go ahead and save the stencil to name it BubbleChart.vss.




    Now we flesh out the Bubble Chart master shape.  Double-click the shape in the Shapes window.  We start with the page itself.  The page will store all the parameters needed for the chart.  Any page properties added here will be replicated on the drawing page once the master shape gets dropped.  Go to Window > Show Shapesheet to edit the Pagesheet - the Shapesheet for the page.  Next go to Insert > Section.  Choose User-defined cells then click OK.




    Scroll down to find the newly added section.  We need to store nine property values.  Right-click and choose Insert Row eight times.  Now we can name each property by clicking on the red row heading and typing.  Enter the nine property names and some default values as shown in the picture.




    Let's look at the properties we're defining.  The chart has an X axis and a Y axis.  For each axis there is a minimum value and a maximum value.  The first four properties will be set by the user.  These are the ranges that will correspond to their data.  The second four properties describe the location of the chart on the page.  They are set by the BubbleChart shape.  Note that the values of these properties have a measurement unit.  Both sets of four properties describe the same points - one from the user's perspective and one from Visio's.  The last property is the size factor.  We need to know how big to make each bubble on the chart.  The size factor is a simple way to record a scale.  Using the default value 10 as an example, a bubble with a Size of 10 in the data set will have a diameter of 1 inch in the chart.


    Now that the page is set up, let's make the chart shape itself.  Close the Shapesheet window for the page and draw a rectangle.  Then go to Window > Show Shapesheet to open the rectangle's Shapesheet.  There are several things to do here.  We need to capture some chart information from the user.  This will be done through Shape Data.  Other information comes from the shape itself.  We'll use User-defined cells to track this information.  Go to Insert > Section and check the User-defined and Shape Data boxes, then click OK.




    We need four User-defined cells to store the page coordinates related to the chart boundaries.  Add three more rows using right-click > Insert Row.  We'll use the same row names as in the Pagesheet.  Next we need to enter formulas to calculate the values from the shape transform.  The bottom left corner of a shape can be found by taking the shape's Pin and subtracting its LocPin.  This is done for both X and Y.  The upper right corner can then be found by adding the shape's Width or Height the minimum values.  So we know the page coordinates for the chart, but we need these to be stored in the page not the chart shape.  We use the function SETF to push the values to the matching User-defined cells in the Pagesheet.  SETF takes two parameters.  First comes a reference to the target cell, which is retrieved using the GETREF function.  Second is the value to be pushed, which is the chart page coordinates.  Enter the row names and formulas as shown in the picture.




    The remaining properties are stored in seven Shape Data rows.  Right-click in a Shape Data row and choose Insert Row six times.  The first four rows will match the Pagesheet names for the data ranges.  Then we add two new rows for X and Y axis labels.  The final row matches the size factor property from the page.  In the Shape Data section, the Label column stores the friendly text that appears in the Shape Data dialog.  The Type column specifies the data type.  Enter 2 for the numeric properties and 0 for the string properties.  Again we need to push the values to the User-defined cell s in the Pagesheet.  In this case SETATREF is a good choice.  The function essentially forwards any value entered to the cell referenced in the function.  Enter the Shape Data information as shown in the picture.




    To prompt the user to fill in the Shape Data properties when the shape is dropped, we use a little trick involving the SETF function.  Normally you just need to set the Ask property in a Shape Data row to pop up the Shape Data dialog on drop.  However, Ask will display the dialog when the shape is either dropped or copied.  In our case, we would prefer not to see the dialog on a copy because the properties are already set.  An alternate mechanism is to put a formula in the EventDrop cell of the shape.  Scroll down to find the EventDrop cell in the Events section.  DOCMD(1312) is the command code for the Shape Data dialog.  This command will fire when the shape is dropped.  To prevent further events from triggering the dialog, SETF is called.  We set a zero in the EventDrop cell itself.  Thus the formula can wipe itself out.




    At this point we have all the functionality of the Bubble Chart shape defined.  In the next post, we complete the master shape by adding labeling.



  • Visio Insights

    Themes and Live Preview in Visio 2010


    In Visio 2007, we introduced the Themes feature to make it easy to apply a professionally designed look to a diagram. In Visio 2010, the Themes feature gets a whole new user interface that takes advantage of the Office Fluent UI. The theme choices are displayed in a gallery on the Design tab in the ribbon.


    An improvement over Visio 2007 is that you can apply both theme colors and effects with one click on a thumbnail in the main Themes gallery, instead of having to visit two separate task panes. Each thumbnail is a pairing of a color scheme from the Colors gallery and an effect scheme from the Effects gallery.

    As in Visio 2007, the color schemes include colors for text, fills, lines, connectors, shadows, and backgrounds, as well as a collection of five accent colors. The effect schemes include the font used in text, as well as formatting for the fills, lines, connectors, and shadows.

    If none of the theme pairs in the main gallery are to your liking, you can choose from any of the schemes in the Colors or Effects galleries, which are located next to the main gallery.


    As in Visio 2007, you can also click “Create New Theme Colors” or “Create New Theme Effects” at the bottom of the gallery to create your own custom theme.

    Live Preview

    Themes is one of the features that demonstrate the Live Preview capability of the Office Fluent UI. As you move the cursor over each thumbnail in the gallery, the theme’s formatting is previewed on your diagram. This lets you quickly experiment with various looks without forcing you to commit to the change. If you don’t click on anything, the diagram reverts back to whatever was applied before the preview.


    Live Preview helps break the repetitive “Undo” cycle of applying formatting to content, deciding against the formatting change, choosing Undo to return to the original formatting, and then starting the cycle all over again.

    Live Preview is available for many other galleries and menus in Visio 2010. Another feature that makes good use of it is the Containers feature discussed in an earlier post. When you move the cursor over the various container designs in the Container gallery on the Insert tab, the container style is previewed on the selected shapes so you can see what it would look like if applied.

    Insert Container

    If you’re running the Visio 2010 Technical Preview, check out the new Themes user interface and Live Preview and let us know what you think via Send a Smile or a comment on the blog.

  • 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

    Update: Visio 2007 Service Pack 2 and Visio Conference 2008


    A few updates…

    XMI Export

    We recently reported the availability of Service Pack 2 (SP2) for Visio 2007.  We received a few questions about how to use the XMI export feature in UML diagrams.  The behavior in SP2 is exactly the same as in previous versions.  Integrating it into the UML solution and retiring the separate download should make life easier for everyone, including us!  The following VBA example demonstrates the interface:

    Application.Addons("UML Background Add-on").Run("/CMD=400 /XMIFILE=""C:\path\file.xmi""")

    The XMI export acts on the active document, so be sure to set that if your application session has multiple documents open.  If you’re not familiar with VBA, the extra quotation marks in the XMIFILE argument are used to escape the quote character – the value passed in must be wrapped in quotes.

    Visio Conference 2008 Videos

    Last year, we posted links to videos from the Visio Conference 2008, where we shared a few glimpses into the next version of Visio.  The links have changed – replace the visioconference2008 part of the URL with visio2008 to get to the video site.  Note that some of the videos are quite large and can take a bit to download.

  • Visio Insights

    Visio 2003 Service Pack 3


    Microsoft has released Service Pack 3 for the Visio 2003 product.  You can download the pack here:

    (If English is not your install language, you can change to another one on the web page.)



    The set of changes is described here: 

    The majority of the changes in this release are security and reliability related as Visio 2003 gets much of the same hardening that has gone into more recent versions.  There are also a number compatibility fixes to help Visio 2003 work with newer products such as IE7, Vista, SQL 2005 and even Visio 2007.

    In particular the hyperlink problem with IE7 as described in this previous post has been corrected.

    This update also applies to those running Visio for Enterprise Architects in Visual Studio 2005.  A number of fixes have been made to the Software / Database functionality that resides in Visio Professional as well as VEA.

    And finally no update to Visio 2003 would be complete without addressing a printing problem.  Visio 2003 has had more than its fair share of printing issues.  SP3 fixes a problem with very long plotter pages.

    This is a beefy download at 48MB but definitely recommended.


  • Visio Insights

    The Office Fluent UI in the Visio 2010 Technical Preview


    The Visio 2010 user interface has been completely revamped this release based on the Office Fluent or “Ribbon” UI. The Office Fluent UI represents a dramatic departure from the overloaded menu and toolbar design model of previous Visio releases. Visio’s extensive capabilities are now organized into logical, easy to find groups that help you accomplish tasks efficiently rather than choosing features.

    There are several design elements that comprise the Office Fluent UI.

    The Ribbon replaces menus and toolbars as the place to find functionality organized to help you accomplish tasks. You’ll find the many features that Visio 2010 has in common with other Office applications on Ribbon tabs of the same name.

    Here’s a brief breakdown of each of the core tabs across the Visio 2010 Ribbon.

    The Home tab contains the most common and frequently used drawing tasks and tools: cut/copy/paste from the clipboard, formatting text and shapes, drawing tools, and shape arrangement.


    The Insert tab is where you introduce new elements into a drawing: pages, pictures, clip art, CAD drawings, as well as new Container and Callout shapes.


    The Design tab includes everything you might change for an entire page: page orientation and size, themes, backgrounds, borders and title blocks, layout commands, and connector styles.


    The Data tab provides everything you need for linking external data to drawings and shapes, displaying that data with data graphics, and generating legends to show the meaning of data graphics.


    The Process tab includes functionality focused on the creation of business process diagrams: simplified creation of subprocesses, validation of diagrams based upon defined rules, import and export of SharePoint workflows.


    The Review tab includes proofing and language tools as well as functionality for inserting and managing comments and other markup when reviewing diagrams.


    The View tab is where all drawing and visual aids that assist diagram creation, such as rulers, grid, AutoConnect, and Dynamic Grid are turned on or off.


    At the bottom of the application window is the new Status Bar. The right side of the Status Bar includes convenient controls for quickly adjusting the zoom level of the Visio drawing, switching into Full Screen mode, or switching between open drawings.


    The left side of the Status Bar includes status items related to what you’re working with. Beyond merely showing status, these items help you take actions. For example, if you need to set the width of a shape, simply select it and click on the Width status item. The Size & Position window is opened with the Width value already selected.


    In the upper left corner of the application window is the Quick Access Toolbar, into which you can add the commands you use most frequently, eliminating the need to switch to the Ribbon tab on which they are located while creating diagrams.


    This post is merely an overview of the primary Office Fluent design elements you’ll see in Visio 2010 Technical Preview. Stay tuned for future posts that will explore the new design in greater detail.

    We're interested in your feedback on the new Office Fluent UI design in Visio 2010 Technical Preview, so use the Send a Smile feedback tool or comment on the blog to let us know what you think.

  • Visio Insights

    The World Cup Summarized as a Visio Diagram


    WorldCup Congratulations to Spain for winning the 2010 World Cup! Now that the games are over and we’re all suffering through soccer withdrawal, here’s a recap of the world cup summarized as a Visio diagram. You can use this diagram as a reference to remember who eliminated who, and which group your team was in. You can also see some stats like who the top scorers were, and who received the most yellow cards.

    And as a bonus, you can view this diagram with Visio Services ! (If you don’t have a SharePoint server handy, you can see what Visio Services looks like).

    This diagram highlights one of the many ways you can use Visio to visualize information. We’ve seen people create intricate diagrams for all types of sports, like bracket diagrams for March madness, elaborate baseball diagrams, and classic Xs and Os for drawing up American football playbooks.

    As always, let us know if you have any feedback on Visio 2010, Visio Services, or suggestions for blog posts you would like to see.

  • Visio Insights

    User Interface Extensibility in Visio 2010


    When Office 2007 was introduced, a new UI paradigm was adopted, and so was a new UI extensibility model, the RibbonX (Ribbon extensibility) model. RibbonX is a XML markup that allows developers to customize the Office UI. It enables 3rd party developers and solution providers to build custom tabs and groups on top of the Ribbon, and target scenarios unique to and optimized for their customers. As Visio 2010 adopts the Fluent UI, Visio developers now also have the opportunity to utilize this platform to build and customize Fluent UI to offer users a more discoverable and instructive UI experience.

    Existing Visio Solutions

    There are two existing mechanisms for UI extensibility in Visio: CommandBar and UIObject. Both would still work in Visio 2010: Visio 2010 automatically creates a new tab called “Add-Ins” with groups for these existing menu commands and toolbar commands and requires no extra work from developers. Here, as an example, we see a top-level menu item called Process Analysis.


    In the Ribbon, this menu becomes a drop-down control that opens to show the menu commands. This automatically-generated tab and its controls require zero-effort for your solutions to migrate to the next release of Visio.

    Although the migration to ribbon can be zero-effort, this really is an ideal opportunity for solution developers to re-think their UI from a Ribbon perspective. The Ribbon provides contextually-relevant commands, and presents them in a way that is more results-oriented. Your UI can integrate more seamlessly with the rest of Visio, and look more like Office. Here is an example of how Visio 2010 reconfigured the Gantt Chart UI, allowing users to more easily discover commands and learn about them through controls of varying sizes, big icons and super tooltips:


    Note, if you are using UIObject in your solution, we especially recommend upgrading to the ribbon. UIObject is a legacy Visio-specific model for defining UI and it may become deprecated in the future.

    RibbonX for Different Types of Add-in Technologies

    Depending on what add-in technology you were using, Visio provides a number of ways to import Fluent UI controls through RibbonX and improve users’ experience. Here is how you achieve that for each type of add-in technology.

    If you’re developing a Visual Studio Tools for Office (VSTO) add-in, you will have access to a visual Ribbon designer that provides a graphical construction environment, similar to other Visual Studio designers. Alternatively, you can specify your UI using RibbonX. Your add-in merely provides an override called CreateRibbonExtensibilityObject that returns an instance of your ribbon object. One-line, very simple to do.

    If you’re writing a shared COM add-in, in your Connect class (the class that implements IDTExtensibility), define an override called GetCustomUI that returns your RibbonX XML as a string. GetCustomUI is the single interface through which the Fluent UI communicates with a COM add-in. Two-to-three lines, still very simple to do.

    VSLs, or legacy Visio add-ons, may also use RibbonX. You add the RibbonX XML to your add-on’s resources. Your add-on defines the GetCustomUI callback and notifies the Visio Application that it has RibbonX XML by calling RegisterRibbonX.

    For VBA, you simply provide the contents of a RibbonX XML as a string directly to Visio through the CustomUI property.

    RibbonX and Visio XML file format

    The Visio XML file format (*.vdx) may also contain RibbonX. The RibbonX markup is stored inside a new element in the Visio XML schema, called, unsurprisingly, RibbonX. The customUI element is the top-level wrapper element in the RibbonX schema.


    Since you can define custom UI directly in the Visio XML file, you have all the benefits of being able to read and write the file without Visio being present. For example, this enables an entire class of server-side scenarios where the server can not only manipulate diagram content, but can also make changes to custom UI in the document.

    Developing with Visual Studio 2010

    The recommended Visual Studio version to develop for Visio 2010 is Visual Studio 2010, which is currently available as Release Candidate. Visual Studio 2010 offers a friendly design environment with the Ribbon Designer, where developers can easily drag and drop ribbon groups and controls onto a graphical design canvas. Also, a Visio 2010 VSTO template is available for you to easily create a Visio add-in project. Multi-project deployment packages, post-deployment actions, and removing PIA dependencies are all benefits from using VS 2010. For more information on what’s new in VS 2010, see this MSDN article.


    With Visio 2010 and the UI extensibility model available, you now have the opportunity to utilize our more intuitive attractive drawing surface to broaden your user base. We highly recommend moving existing solutions to the Fluent UI. It is worth the work to get rid of the old menu bars, and help your users realize the full capability of your solution by making it easier to use. For new and old solution developers alike, Visual Studio 2010 allows a great way to easily develop Fluent UI for Visio 2010 as well.

    To get more details about UI extensibility for Office 2010 applications, here are some helpful links:

    Microsoft Office 2010 Engineering blog

    UI Extensibility in Office 2010- Including details on customizing Office Menu and Backstage View

    MSDN documentation

    Office Development in Visual Studio 2010

    How to setup the Ribbon Visual Designer

    Ribbon best practices

    Do try implementing your own Visio ribbon and send us feedback through the Send a Smile feedback tool or comment on this post!

  • Visio Insights

    Visio 2010 Release Dates


    Last week on the Office Engineering Blog, Microsoft confirmed the release dates for Visio 2010, Office 2010, SharePoint 2010, and Project 2010.

    We’re happy to announce that Visio 2010 and the rest of the Office suite will release to manufacturing (RTM) next month.

    • For businesses, Visio 2010 and the rest of the Office 2010 products will be available worldwide on May 12th.
    • For consumers, Office 2010 and Visio 2010 will be available online and on retail shelves this June. Until then, you can get the Visio 2010 Beta here

    Office 2010 Technology Guarantee

    Consumers who purchase and activate Office 2007 or Visio 2007 will be able to download corresponding Office 2010 or Visio 2010 products at no additional cost when they become available in June 2010.

    All you need to be eligible for this program – Office 2010 Technology Guarantee – is the following:

    • Purchase Office 2007 (or Visio 2007), or a new PC with Office 2007, and activate it between March 5, 2010 and September 30, 2010.
    • Have, or create a Windows Live ID.
    • Redeem your Tech Guarantee before October 31, 2010 by visiting .

    For more information about the Office 2010 Technology Guarantee, and to sign up for an e-mail reminder when Office 2010 is available, visit

    As always, let us know in the comments if you have any questions or topics you’d like to see us discuss here in the future.

  • Visio Insights

    CAD Integration in Visio - Part 1


    Visio has long had the ability to display, import and export CAD drawings stored in the DWG and DXF file formats.  If you are unfamiliar with the ways that Visio can work with CAD drawings, please read through this previous post.


    In Visio 2003 the CAD feature set was overhauled to improve performance and reliability plus provide a better mapping of Visio shapes to CAD entities on Export.  There were changes in the CAD Display Properties and Conversion dialogs as well.  Unfortunately there were a number of serious bugs that impacted the functionality of the feature set.  A few items have been fixed in Visio 2003 service packs, but many more were addressed in Visio 2007.


    This post describes the problems in Visio 2003 that were corrected in Visio 2007.  The next post will discuss the remaining issues surrounding Visio's CAD integration.



    Insert CAD Drawing

    There are two ways to display a CAD drawing in a Visio document.  If you go to File > Open, you can point directly at the DWG or DXF file and open it.  Visio creates a new blank drawing, chooses a page scale that will fit the CAD drawing to the Visio page and adds the CAD drawing.  Another method is to start from an existing diagram and go to Insert > CAD Drawing.  Visio shows the CAD Drawing Properties dialog and allows you to specify the scale you want to use.  Unfortunately, there are several issues going this route in Visio 2003:




    ·         Visio defaults to a custom scale that fits the CAD object to the page, but this scale does not match the scale of the Visio page.  If you choose this default, the CAD object will be scaled incorrectly with respect to everything else in the diagram.  When inserting into an existing diagram you should always choose the current page scale.  The custom scale default is really only useful when you want to use the CAD drawing as an unscaled image in your diagram.


    ·         Since CAD drawings don't explicitly define what units of measure are used, you must specify the CAD drawing units in the dialog to properly scale the CAD object.  This can be confusing, and in Visio 2003 the setting doesn't work.  The value is ignored, resulting in improper scaling for CAD objects drawn in Metric coordinates.


    ·         For those who bravely tried to get the scale settings configured properly, there is one more problem:  The preview pane did not update as you made changes to the settings.  Thus the visual feedback about what you would get was also wrong.


    These issues combined to make Insert > CAD Drawing very challenging in Visio 2003.  Settings either didn't work or were configured improperly by default.   This created unnecessary confusion and frustration for customers.  Visio 2007 corrects these problems, although it is still the responsibility of the user to set the CAD drawing units properly to end up with the right scale.


    A note of caution for Visio 2007:  The CAD Drawing Properties dialog does not remember settings very well.  Once you close the dialog and reopen it, you will have to reset the Pre-defined scale to Page Scale again.  Also do not manually resize the CAD object using the green shape handles since this just distorts the scale.



    Export CAD Drawing

    Visio drawings are exported to CAD files using the File > Save As > DWG / DXF command.  If there is no existing CAD object in the drawing, Visio converts the Visio shapes to entities correctly.  If there is a CAD object in the drawing, Visio 2003 fails to use the proper scale to ensure that the converted Visio shapes match up with the existing CAD object's entities.  It also fails to position the converted shapes relative to the existing CAD entities.  Additionally any cropping or rotation of the CAD object is ignored in the exported file.


    Visio 2007 corrects most of the scaling and positioning issues.  There are a few cases with dimensions that still are troublesome.  Visio 2007 does not support cropping or CAD object rotation on export.



    Customer Input

    Many of the fixes in Visio 2007 can be credited to a group of customers that are passionate about Visio and its use with CAD drawings.  At the Visio Conference in 2006 the product team showcased the upcoming Visio 2007 version with its emphasis on data connectivity.  However, a number of partners and customers voiced concerns about the problems with CAD in Visio 2003.  In an ad-hoc meeting, we sat down with all interested parties to understand the issues and hear firsthand how important the feature is for these customers.


    Following the conference, the Visio team did an extensive review of the CAD feature set to uncover the bugs that were causing the most customer pain.  These issues were corrected in Visio 2007 and released as part of the Visio 2007 betas to have partners and customers verify the fixes.  The result is a significantly better experience in Visio 2007 over Visio 2003.  We weren't able to address all concerns though.  Next time we will look at the current state of CAD integration in Visio.


  • Visio Insights

    Container, List and Callout API in Visio 2010


    This post examines the programmability features for Containers, Lists and Callouts in Visio 2010.  It supplements an earlier post that describes how these special shapes are constructed and how they can be customized.  Collectively these shapes are known as Structured Diagram elements, and the part of the Visio API that manages these elements is known as the Structured Diagram API.  This API enables developers to use Structured Diagram elements in their solutions.  Developers can identify the relationships between these elements and other shapes, they can add or change the relationships with other shapes, and they can detect when the user makes changes to the relationships with other shapes.


    Structured Diagram API Overview

    Here are the key objects, properties and methods in the Structured Diagrams API:


    There are two new objects in the API.  ContainerProperties is an extension of the Shape object.  It encapsulates the special properties and behaviors of containers and lists.  RelatedShapePairEvent is an object used with the Structured Diagram API events, where Visio can describe a relationship being formed or broken between two shapes.  The remaining parts of the API are additions to existing Visio objects.

    Note that lists are just another type of container as far as the API is concerned.  Therefore, lists use all the same objects, properties and methods as containers; and lists have a few additional properties and methods as well (those with “List” in their name).


    Enabling Structured Diagram Behaviors in Solutions

    Visio 2010 introduces a new feature called Diagram Services that manages what diagramming behaviors are enabled in the document.  There are diagram services that control the behavior of Auto Size Page and diagram services that control the behaviors of Containers, Lists and Callouts.  These services are turned on and off at the document level.  When a service is off, changes made in the diagram through automation will not trigger the diagramming behaviors related to that service.  (Changes made through the user interface are not subject to the diagram service state.)

    For example, the Auto Size Page feature will normally grow the page size if a shape is placed outside the page boundary.  However, when a shape is placed outside the page via automation, the Auto Size Page feature will only respond if the Auto Size Page diagram service is enabled.  Similarly, dropping a shape on top of a container will normally make it a member of the container and cause the container to resize to fit it.  However, when the shape is dropped via automation, the Containers feature will only respond if the Structured Diagram service is enabled.

    The reason Visio 2010 includes this capability is that solutions may not always want these diagramming behaviors to get triggered while they are manipulating shapes in the diagram.  This may especially be true for existing solutions that have no knowledge of the new Visio 2010 behaviors and have expectations that shapes respond in ways consistent with Visio 2007.  In order for existing solutions to work as originally designed, all diagram services in Visio 2010 are disabled by default.  Solutions must opt the document in to the new diagramming behaviors.  Note that diagram service states apply to automation properties and methods that existed in Visio 2007.  When a new Visio 2010 automation method is explicitly invoked by a solution - such as any of the examples below – the service state is ignored.  The presumption is that the solution wants the Visio 2010 behavior associated with that method.

    Diagram service states are checked or changed using the Document.DiagramServicesEnabled property.  The value of this property is a mask of all the services currently enabled.  Available services and values are listed in the table below.  It is possible for a solution to opt into just one service, all the services supported in Visio 2010, or even all existing and future services.

    VisDiagramServices values:

    Enum Value Description
    visServiceAll -1 All diagram services
    visServiceVersion140 7 Diagram services that exist in Visio 2010
    visServiceNone 0 No diagram services (default)
    visServiceAutoSizePage 1 AutoSize page behaviors
    visServiceStructureBasic 2 Behaviors that maintain existing Structured Diagram relationships but do not create new relationships
    visServiceStructureFull 4 Structured Diagram behaviors that match the behaviors in the user interface

    There are two services for Structured Diagram behaviors.  The StructureBasic service maintains relationships but will not form new ones.  This might be appropriate for a solution that wants to respect the user’s usage of Containers, Lists and Callouts but does not want the solution itself to inadvertently form relationships when shapes are moved around the page.  The StructureFull service maintains relationships and will form new relationships as well.  This matches the behaviors that are triggered in the user interface.  If both services are enabled, then Visio uses the StructureFull set of behaviors.


    Common Tasks with the Structured Diagram API

    Let’s look at some typical Structured Diagram tasks to explore the API in greater detail.  For a complete list of the special flags that can be passed into the methods, look at the Object Browser within the VBA editor in Visio.

    Add a container to the page

    Containers can be added to a page by calling the traditional Page.Drop method, which will add the shape at coordinates you specify without affecting the membership of existing shapes on the page.  However, there is a new Page method – Page.DropContainer - that will not only drop the container but will also size it around a set of shapes and make those shapes members of the container.  This is the behavior in the UI when using Insert > Container when a selection exists.  DropContainer needs an object for the container shape.  If you want to use one of the shapes in the Insert Container gallery, you can use the GetBuiltInStencilFile method to retrieve the hidden stencil where these containers are stored.

    Dim vsoDoc1 As Visio.Document
    Set vsoDoc1 = Application.Documents.OpenEx(Application.GetBuiltInStencilFile(visBuiltInStencilContainers, visMSUS), visOpenHidden)
    Application.ActivePage.DropContainer vsoDoc1.Masters.ItemU("Container 1"), Application.ActiveWindow.Selection

    Add a shape to a container

    Shapes are added to a container by moving or dropping them onto the container (if the StructureFull diagram service is enabled).  Shapes can be explicitly added to a container using the AddMember method.  This is useful when the shape already overlaps the container and is not yet a member.  It is also helpful if you want to force the container to expand to encompass the new member.

    vsoContainerShape.ContainerProperties.AddMember vsoShape, visMemberAddExpandContainer

    Find the containers on a page

    To discover what containers exist in a document, Visio provides a direct way to get the set of containers in a selection or on a page.  The GetContainers method returns an array of Shape IDs for the containers.  Containers nested within other containers can be included or excluded using flags.

    For Each containerID In vsoPage.GetContainers(visContainerIncludeNested)
        Set vsoContainerShape = vsoPage.Shapes.ItemFromID(containerID)

    Get the shapes in a container

    Solutions can identify the members of a container using the GetMemberShapes method, which returns an array of Shape IDs for the member shapes.  The flags allow certain kinds of member shapes to be filtered out of the array returned.

    For Each memberID In vsoContainerShape.ContainerProperties.GetMemberShapes(visContainerFlagsDefault)
        Set vsoShape = vsoPage.Shapes.ItemFromID(memberID)

    Reorder a list

    Every member of a list is placed in a specific position, and that ordinal value can be retrieved with the ContainerProperties.GetListMemberPosition method.  To reorder a member, you can call the ContainerProperties.ReorderListMember method.  Both methods use 1 to indicate the first position in the list.

    vsoListShape.ContainerProperties.ReorderListMember vsoShape, 2

    Add a callout to the page

    Callouts can be added to a page by calling the traditional Page.Drop method, which will add the shape at coordinates you specify.  However, there is a new Page method – Page.DropCallout - that will not only drop the callout but will associate it with a target shape and position it near the target shape.  This is the behavior in the UI when using Insert > Callout when a selection exists.  As with DropContainer, DropCallout needs an object for the callout shape.  If you want to use one of the shapes in the Insert Callout gallery, you can use the GetBuiltInStencilFile method to retrieve the hidden stencil where these containers are stored.

    Dim vsoDoc1 As Visio.Document
    Set vsoDoc1 = Application.Documents.OpenEx(Application.GetBuiltInStencilFile(visBuiltInStencilCallouts, visMSUS), visOpenHidden)
    Application.ActivePage.DropCallout vsoDoc1.Masters.ItemU("Callout 1"), vsoTargetShape

    Get the target shape for a callout

    A shape can have multiple callouts, but a callout can have only one target shape at a time.  The Shape.CalloutsAssociated property returns an array of callout shape IDs.  You can get or set the target shape of a callout using the Shape.CalloutTarget property.

    Set vsoShape = vsoCalloutShape.CalloutTarget

    Structured Diagram Events

    In addition to manipulating the containers, lists and callouts in a document, you can also respond to user actions that relate to these shapes.  Containers, lists and callouts work by establishing relationships with other shapes.  Visio fires an event whenever one of these relationships is formed or broken.  For example, adding a shape to a container forms a new relationship between the shape and the container.

    When a relationship event fires, Visio specifies the details in a RelatedShapePairEvent object.  The FromShapeID property of this object indicates the container, list or callout involved in the relationship.  The ToShapeID property indicates the other shape involved in the relationship.  Thus when adding a shape to a container, the ToShapeID would refer to the new member shape, and when associating a callout with a target shape, the ToShapeID would refer to the target shape.

    The following events are available for Application, Documents, Pages and Page event lists:





    Also the ShapeChanged event will now fire when members of a list shape are reordered.  The event passes the list shape as an argument and includes the string “/ListReorder” in the EventInfo argument.



    The Structured Diagrams feature set – Containers, Lists and Callouts – offers both end users and developers significant new diagramming capabilities in Visio 2010.  We’re interested to hear what developers think of this API functionality, so please use the Send a Smile feedback tool or leave a comment below.

  • Visio Insights

    Shape Conversion in Process Engineering


      A recent newsgroup post asks for an explanation of the cells that get added to a shape when it is converted using the Process Engineering add-on. 


      The Shape Conversion command in Process Engineering allows you to make any shape work like the built-in Process Engineering shapes.  We recognized that customers who made Piping & Instrumentation diagrams often had custom equipment or valves or instruments that they needed to include in the diagram.  Shape Conversion modifies a custom shape to make it recognizable by the Process Engineering add-on and match the behaviors of built-in shapes.


      You can try this by drawing a rectangle and choosing Shape Conversion from the Process Engineering menu.  In the dialog, note that the shape Source is already set to Selected Shapes.  Process Engineering can also bring in shapes from other documents or CAD symbols.  Then comes the challenging part: you can optionally give the shape a Category and Tag Format.  Categories are used to organize the shape in the Component Explorer window.  You can choose an existing category or type in a new string.  Tag formats are used for automatically labeling and numbering shapes.  You must choose from an existing tag format.  Visio only offers you choices for Categories and Tag Formats that already exist in the drawing, so if you want your shape to be a piece of Equipment you should drop a built-in Equipment shape on the drawing before converting your custom shape.



      After clicking OK, you can open the Shapesheet window to see what changes were made to your shape.  The primary change is the set of User-defined cells added to the shape.  These cells identify the shape and control its behavior in the diagram.



      Here is a brief explanation of each cell:


      A GUID (unique identifier) that tells Visio what add-on is managing the shape.  All shapes that are used with Process Engineering, need the GUID matching the Process Engineering add-on.


      The Category that the shape is assigned to.  The shape appears under this name in the Component Explorer.


      The current tag name (label & number) for the shape.


      The Tag Format name and expression for the shape.  Unless the Component Tag has been overwritten, this is the automatically generated label displayed on the shape.


      The sequence number for the shape.  Visio updates this value when components are renumbered.  This value then feeds into the Component Tag.


      A Boolean value that determines whether the Component Tag is displayed on the shape.  This is manipulated by an Action in the Actions section.


      A value that references the global page setting for hiding tags.  If tags are hidden at the page level, then the local setting is ignored.


      This is a bit flag that controls the layout behavior of the components in the diagram.  Mostly these settings determine how the split and heal features in Process Engineering work.  Here are the bits:


      CAUSES SPLIT = 1 (Splits connector when dropped on connector)

      CAUSES HEAL = 2 (Heals connector when deleted)

      ALLOWS SPLIT = 4 (Connector splits when shape dropped)

      ALLOWS HEAL = 8 (Connector heals when shape deleted)

      ALLOWS JUNCTION = 16  (Connector to connector connection)

      JUNCTION IN USE = 32  (Temporary state)


      The default setting here is 31, which enables all the split and heal and junction behaviors.


      There are a few other changes to connection points, action cells and text to complete the conversion.  These are straightforward changes, and you can inspect the Shapesheet to see the details.


  • 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

    Need help finding commands in the new Visio 2010 ribbon?


    In Visio 2010, we completely revamped the Visio user interface and adopted the Office Fluent UI or the “Ribbon”. With the Office Fluent UI, Visio’s extensive capabilities are organized into logical, easy to find groups that help you accomplish tasks efficiently. The breakdown of each of the core tabs in the Visio 2010 Ribbon was explained in a previous post.


    Although the Office Fluent UI was designed to help make the Office applications easier to work with, we realize that there is a learning curve for the new Office Fluent UI.

    Did you know that there are tools available to help you learn the new Visio 2010 Ribbon?

    Office 2010 menu to ribbon reference workbooks

    Looking for a list of the 2007 menu and toolbar commands and their new 2010 locations? You’re in luck! Each Office application has an Excel workbook that lists the old menu commands and their new locations in the Office Fluent UI. You can find these workbooks here.


    Interactive guides to find commands

    Would you prefer an interactive program that shows you the new location of a command? Interactive guides for each Office application can be found here. Just click the Visio 2007 command or button that you want to find and the guide will show you its location in Visio 2010. These guides are available as online tools or can be installed on your own computer for use any time (even when you’re not connected to the Internet).


    We are enjoying the new look and feel of Visio 2010, and hope you feel the same way! If you have questions or comments about the Visio 2010 Ribbon, please comment on our blog and let us know.

  • Visio Insights

    The Point Along Path ShapeSheet Functions in Visio 2010


    In a previous blog post about new ShapeSheet functions, we introduced a set of new functions called the Point Along Path functions. These functions allow interactions with geometry paths of shapes. This post provides more detail about these new functions.

    The following functions open up a broad set of shape interactions for shape and solution developers:



    ANGLEALONGPATH(section,travel [,segment]) Returns the angle of the tangent to the path at a given point.
    DISTTOPATH(section,x,y) Returns the shortest distance from the point represented by the specified coordinates to a point on the path.
    NEARESTPOINTONPATH(section,x,y) Returns the percentage of the distance along the path of the point that is nearest to the specified coordinates, as a value between 0 and 1.
    PATHLENGTH(section[,segment]) Returns the length of the path that is defined in the specified Geometry section.
    PATHSEGMENT(section,travel) Returns the 1-based segment number at the specified percentage mark along the specified path.
    POINTALONGPATH(section,travel[,offset][,segment]) Returns the coordinates of a point on, or offset from, the path.
    SEGMENTCOUNT(pathRef) Returns the number of line segments that make up the path.

    In the above functions:

    • Arguments in brackets [ ] are optional
    • Section always refers to a Geometry path. The correct way to reference a geometry path section is to enter the section reference followed by “.Path” (for example, Sheet.1!Geometry2.Path)
    • Travel is a measure of the position along the path between the beginning and the end points, defined as a percentage. It is always represented by a number between 0 and 1, where 0 represents the beginning point, and 1 represents the end point
    • Segment is a 1-based index of a line segment in the path that corresponds to a row in the geometry section.

    To give you an idea of what you can do with these functions, we'll explore three examples.

    Adorning a Connector

    We've seen shape developers create connector adornments to convey additional information. With the Point Along Path functions, this is now easier than ever to do.

    Here's a simple triangle shape that sits at the midpoint of the connector, and changes direction with the connector. It works with curved and right angle connectors:


    To create this adornment, you only need a few ShapeSheet formulas:

    • First, make sure that the adornment shape will be ignored by the Visio routing engine. To do this, select the shape, and click "Behavior" from the Developer tab. In the ensuing dialog, click on the "Placement" tab, and ensure that placement behavior is set to "Do not lay out and route around".
    • Create a user cell in the adornment shape (we'll call it User.ConnectorGluePoint, and use the POINTALONGPATH() function and reference the connector that the shape will adorn:
      • POINTALONGPATH(Dynamic connector.23!Geometry1.Path,0.5)
      • This returns a point in local coordinates to the connector
    • Create another user cell, User.PageCoord, and use the LOCTOPAR() function to translate the local coordinates to page coordinates:
      • LOCTOPAR(User.ConnectorGluePoint,Dynamic connector.23!User.msvThemeColors,User.msvThemeColors)
      • The LOCTOPAR function needs cell references for the source and destination of the translation. Here we arbitrarily use User.msvThemeColors because the property exists in both the source and destination.
    • Now, set PinX,PinY, and Angle cells on the adornment shape accordingly (found in the Shape Transform section):
      • PinX: GUARD(PNTX(User.PageCoord))
      • PinY: GUARD(PNTY(User.PageCoord))
      • Angle: ANGLEALONGPATH(Dynamic connector.23!Geometry1.Path,0.5)-PI()/2
        • We subtract PI/2 because we’re using a triangle and the point is not aligned with the 0 angle. The ANGLEALONGPATH() function returns the tangent angle to the specified point on the path.

    Finding the Nearest Point on a Path

    You can use the NEARESTPOINTONPATH() function to find the coordinates of a point along a path that is closest to a given point. In the picture below, the triangle shape is showing the nearest point along the path to the center of the circular shape:

    nearest point

    Here’s how we setup the triangle to do this:

    • Create a user cell in the triangle shape to store the point of the circle shape (we’ll call it User.LocalPoint) Use the following formula to transform the LocPin point of the circle into local coordinates relative to the curve:
      • LOCTOLOC(PNT(Circle!LocPinX,Circle!LocPinY),Circle!Height,ArcLine!Height)
      • We use the PNT function to turn the LocPinX and LocPinY into a point
    • Create another user cell in the triangle (we’ll call it User.Travel) to store the percentage along the path (the travel) that is nearest to the circle. Use the following formula:
      • NEARESTPOINTONPATH(ArcLine!Geometry1.Path,PNTX(User.LocalPoint),PNTY(User.LocalPoint))
      • This returns the percentage along ArcLine!Geometry1.Path that has the nearest point to the center of the circle shape
    • Create another user cell (we’ll call it User.ArcGluePoint) to store the point along the path of the arc that is closest to the circle. Use the following formula:
      • POINTALONGPATH(Sheet.1!Geometry1.Path,User.Travel)
      • This will return the point on the arc where the triangle should be glued, in local coordinates relative to the arc.

    Just like the example above, you then need to transform the local coordinates, and set the PinX and PinY of the triangle so that its glued to the arc.

    Curved Timelines

    The above two examples illustrate how you can use the Point Along Path functions. As an application of the same concepts above, we built a curved timeline:
    curvy timeline

    As you change the curve of the timeline, the milestone shapes stay attached to the curve, which allows you to create a great looking visual.

    The main difference between this example and the previous one is that we’ve introduced a mechanism for automatically attaching adornments to the arc geometry. Here we turned the arc shape into a custom container to give the milestone shapes a universal reference. Since they are members of the container, we use the CONTAINERSHEETREF() function to reference the geometry of the arc. When you make multiple copies of the milestone shape, their reference to the timeline arc geometry is preserved as long as they are members of the container. (For more info on custom containers, see our previous post ).

    To place the milestones accurately on the timeline arc, we used the POINTALONGPATH() function. Each timeline shape stores its own date. The timeline arc contains the “begin” and “end” dates of the timeline.

    The attached VSD file includes the curved timeline, and the other two examples, so you can take a look at the formulas and play around with them.

    We think these new functions will open up a new set of scenarios for shape developers. Some things you might try to create with them are:

    • Placing text or adornments at fixed distances from the beginning or end of a connector
    • Detecting whether a point is inside or outside a closed path
    • Calculating the lengths of curved paths in a diagram
    • Drawing a line that terminates on a complex path

    As usual, please tell us what you think by using the Send a Smile feedback tool or by commenting on this post.

Page 4 of 8 (181 items) «23456»