Visio Insights
The official blog of the Microsoft Visio product team

  • Visio Insights

    Extra drawings opening on Visio launch


    This situation has come up frequently enough in the newsgroups that the solution should be widely circulated:

    When Visio crashes, it will often restart and recover the document you were working on.  This is generally quite helpful, but sometimes Visio doesn't know when to stop.  Sometimes Visio will continue to recover that document and show it to you every time you launch Visio.  This can be frustrating, but there is a solution.

    Close Visio.  Then look in the folder "%userprofile%\Local Settings\Application Data\Microsoft\Visio" using Windows Explorer.  Some of the folders in the path are hidden, but you can usually paste the path found between the quotation marks directly into the address bar and press Enter.  Now find the file autorecover.ini and delete it.  The recovered documents should stop reappearing when Visio is launched.


  • 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

    CAD Integration Announcement for Visio "vNext"


    This morning at Day 2 of Visio Conference 2008, we announced that the next version of Visio will add support for AutoCAD 2007 DWG and DXF file formats.  As mentioned in previous blog posts, this was a major request from Visio customers and partners.

    General Manager Richard Wolf explained in his keynote address how Visio prioritizes feature investments that improve the entire Visio platform over changes that enhance just a single vertical market.  CAD integration is valuable to a broad set of customers spanning the Engineering, Facilities Management and Information Technology markets.  Richard then demonstrated an example of inserting an AutoCAD 2007 floorplan of a data center, overlaying Visio server shapes, adding Data Graphics to show cabinet temperatures and then publishing the diagram to Visio Services for display in a web dashboard.  Thus, while CAD integration does not fall under the three investment areas described on Day 1, it was high on the team's priority list for Visio "vNext" given the applicability to data visualization scenarios across several diagram types.



    Day 2 also featured demonstrations of new capabilities for developers and shape designers:


    Visio "vNext" adds support for RibbonX, the API for the Office Fluent user interface.  Existing Visio solutions with custom UI will work unmodified in the Ribbon, but solutions can use RibbonX for a much richer integration into the Ribbon.

    Structured Diagrams

    Visio "vNext" allows solution developers to work with Visio diagrams at a logical level instead of at the physical level.  Visio exposes relationships between shapes that can be discovered and traversed to simplify the understanding of the diagram structure.  Three common relationships are defined: connectivity, containment and callouts.

    Visio Services API

    Visio "vNext" provides a JavaScript API for accessing and enhancing diagrams rendered by Visio Services.  Web page scripts can extract information about the shapes displayed in the diagram for use in another frame.  Scripts can also highlight shapes, place overlays on shapes and manipulate the diagram's viewport for pan and zoom.


    The feedback received over the last two days at the Visio Conference has been tremendous.  We're happy to see people so enthusiastic about our Visio "vNext" plans.  There is still much work to be done, and we hope that the Visio community will continue providing feedback as we disclose more over time.


  • Visio Insights

    Visio "vNext"


    Tuesday more than 300 customers, partners and Visio community members gathered for Day 1 of Visio Conference 2008.   Attendees were treated to an impressive array of partner solutions, product demonstrations and information-filled sessions.  To top it all off, attendees got the first sneak peak at the next version of Microsoft Office Visio. 




    At this point Visio "vNext" is still in an early stage (pre-Alpha), but we wanted to give everyone a glimpse of the fantastic capabilities of the next version and outline our high-level investments.  Keep in mind that plans can and do change as we respond to feedback and continue working toward completion.  We are publicly showing just a few of the features planned.  Here are the three areas where we are concentrating most of our efforts:




    Process Management

    Visio "vNext" reinvents the core flowcharting experience in Visio.  Flowchart creation is faster and easier than ever.  Cross-functional flowcharts in particular are improved.  Going beyond a simple drawing canvas, Visio understands the logical structure of the diagram far better.  This leads to more advanced process diagramming capabilities that put the user firmly in control over the graphical representation of their processes.


    Ease of Use

    Visio "vNext" adopts the Office Fluent user interface that you see today in Office 2007 core applications.  The Ribbon and Live Preview components in particular take the guesswork out of finding Visio commands and choosing between settings.  At the same time Visio improves a wide range of existing features, bringing the results-oriented concepts behind the Fluent UI onto the diagramming surface itself.  The Shapes window, layout and AutoConnect are significantly enhanced.  Visio is even easier to use and significantly reduces the time needed to create and modify diagrams.


    Visio Services

    Visio "vNext" introduces server-rendered, data-refreshable diagrams for the first time.  Visio Services allows data connected diagrams to be published from Visio to a server and viewed by users directly in their web browser.  There are no client bits to install.  An API is also provided for creating mashups of diagrams and additional data.



    There is far more to talk about with Visio "vNext".  In future posts we will begin to provide more details and present screen shots.  However, there are also plenty of things to discuss about the current Visio 2007 product.  We'll cover both in the coming months.  Please stay tuned and be sure to give us your feedback.


  • Visio Insights

    Visio as a Business Process Analysis Tool


    Visio had the opportunity to present at Microsoft's SOA & BP conference last November on using Visio as a Business Process Analysis Tool.  A video of that presentation is now available for viewing.  Mark Nelson from the Visio team describes how Visio 2007 helps bring BPA to the masses through its in-box feature set and robust solutions platform.  Also Keith Sharp from partner Ascentn demonstrates their AgilePoint BPM product, which is built on the Visio platform.


  • Visio Insights

    Images and the Dynamic Grid


    A recent newsgroup post described a problem getting the Dynamic Grid feature to work with images.  The user inserted pictures into their diagram and wanted the same alignment aids that Visio provides for regular shapes.  This can be done with a small modification of the image shapes.  First let's look at the Dynamic Grid behavior for regular Visio shapes (i.e. shapes with geometry).


    The shape on the right is being dragged near the shape on the left.  When the Dynamic Grid is turned on (Tools > Snap & Glue dialog), Visio displays both horizontal and vertical alignment lines.  The horizontal line indicates that the centers of the shapes are aligned.  The vertical line indicates that the shapes will be separated by a standard spacing amount.

    If you try the same thing with images, Visio produces different results.

    The vertical alignment line is shown, but the horizontal line is not shown.  These shapes do not have any visible geometry, which Visio uses as criterion for alignment.  When you insert a picture in Visio, the resulting shape has a geometry section but the Line Pattern is set to No Line.  It turns out that by making a simple adjustment in the shape, you can make Visio recognize the hidden geometry section and get full Dynamic Grid support.  In the Shapesheet (Window > Show Shapesheet), find the LinePattern cell and set it to 1.  This makes the shape work with Dynamic Grid.  Now to hide the rectangle around the image, find the Geometry section and set Geometry1.NoShow to TRUE.  This makes the border invisible once again but does not disrupt the Dynamic Grid behavior.

    Here is the feedback when the Dynamic Grid is working with the modified image shapes.  Note that the change must be made on the shape your are aligning to (i.e. the shape not being dragged).

    Perhaps Visio can make this workaround unnecessary in the future.  Meanwhile this is one way to make your images behave just like regular Visio shapes.


  • Visio Insights

    Visio Toolbox Site


    Visio Toolbox graphic

    Microsoft has significantly updated its Visio product information on the web.  Check out the new site at

    You will find articles, training and downloads that provide a wealth of information on Visio 2007.  Those that found the previous IT Toolkit valuable will appreciate the free products and promotional offers on the site.  Note that some items require you to register on the site first.


  • Visio Insights

    CAD Integration in Visio - Part 2


    In the previous post we reviewed the problems users were encountering with the CAD Integration feature set in Visio 2003 and the fixes that were made in Visio 2007.  In this post we look at the remaining issues with CAD and Visio.



    Converting CAD drawings to Visio shapes

    Visio 2003 changed the way that CAD drawings are converted to Visio shapes.  Instead of converting each entity and adding it as a Visio shape, the entities are converted in bulk to an intermediate document and then the entire document is merged into the current drawing in one big Paste operation.  This change makes conversion up to 10 times faster – a significant improvement.  However, Visio now requires quite a bit more memory to accomplish the task.  On PCs without sufficient memory, performance degrades because Visio must page memory to disk. 


    Additionally we have found that some really large CAD files fail to convert.  There is a limit to the number of entities that can be converted at once, though this limit is not easily expressed as a quantifiable number.  Unfortunately the failure comes near the end of the lengthy operation rather than at the beginning.  Visio 2007 does not remedy this situation.  Your best bet is to divide up the diagram into more layers and then convert the layers individually.  While Visio should handle this situation better, keep in mind that CAD programs are designed to deal with hundreds of thousands of simple entities and Visio is designed to deal with thousands of complex entities.  It's difficult to scale up to support the largest CAD drawings out there.  Simplifying the drawing before bringing it into Visio is recommended.



    DWG file formats supported by Visio

    A frequent complaint from users is that Visio refuses to open a DWG file because it was saved in a newer format.  Visio 2003 and 2007 do not support the latest file formats used in AutoCAD programs.  That means CAD files must be saved back to a compatible version before they can be used with Visio.  Visio 2003 and 2007 support the R15 version of the DWG format.  This was the default format used by AutoCAD 2000 and AutoCAD 2002.  Newer versions of AutoCAD save to newer versions of the DWG format by default.


    Additionally, Visio does not support all the entities defined in the R15 version of the DWG format.  In terms of entity support, Visio handles the entities defined in the R14 version of the DWG format with a few exceptions.  A specific entity list is beyond the scope of this blog post.  The point is that the level of entity support and the version of the file format supported are not identical.


    Note that there was a specific problem where files saved out from AutoCAD 2007 would not open in Visio 2007 even when saved back to the R15 format.  This was corrected in Visio 2007 SP1.



    What's next for CAD integration 

    It's too soon to announce our plans for the next release.  We continue to gather information from customers about their needs for CAD with Visio.  Your input on specific issues or the overall importance of CAD integration to your Visio usage is encouraged.



  • 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

    Visio 2007 Service Pack 1


    It's been about a year since the release of Visio 2007 and Office 2007, and Microsoft has now published Service Pack 1.  Here is the download link for English.  You can choose another language from this link as well.

    The goals of this service pack are to provide compatibility for upcoming releases such as Windows 2008 Server, improve security and address key performance and reliability issues.

    A specific fix to note for Visio:

    • Microsoft Office Visio 2007 now properly redraws shapes when users apply a dynamic connector that is part of a group of shapes in Office Visio 2007.

    The KB article with all the details is here:


  • Visio Insights

    Reminder About Visio Conference 2008


    The Early Bird registration for the 2008 Visio Conference ends November 30.  Sign up by then for a discounted rate.  More information about the specific agenda, tracks and sessions is now available on

    In addition to the general sessions, there are tracks for Business Solutions, Solution Developers and End Users.  Find out how to get the most out of Visio 2007 and integrate Visio into your organization.  This is also your first opportunity to learn about what's coming in the future for Visio.



  • Visio Insights

    New Visio Blog


    Things have been quiet here for a bit because the product team is heads down on development.  In the meantime a new blog has joined the Visio community that you might be interested in.

    John Goldsmith is the author and a frequent newsgroup poster.  John hopes to cover common problems discussed on the newsgroups and encourage more people to dive into the Shapesheet and Visio programmability.

    If you are authoring a Visio blog and want to let us know about it, please leave a comment with the information.

  • Visio Insights

    Register for the 2008 Visio Conference


    It's time to make plans to attend the 2008 Visio Conference, the premier gathering event for the Visio community.  The Visio Conference is your chance to interact with fellow enthusiasts from around the globe including Visio partners, MVPs and the product team as well.

    The last conference was held in January 2006.  Those that attended found the experience quite rewarding.  Since that time Visio 2007 has shipped, enabling many new possibilities for data connected solutions.  The details on specific conference sessions are coming, but you can check out the material from 2006 in the meantime.  The conference web site with all the information is linked below.





    Make connections and gain the skills and resources to make the most of Visio at the Microsoft Office Visio Conference, February 5-6, 2008 at the Microsoft Conference Center in Redmond.  The event will bring the global Visio community together to network, share best practices and discuss the market opportunities for data visualization. 


    Keynote speakers Jeff Raikes, President of the Microsoft Business Division and Richard Wolf, General Manager of Office Graphics, will kick off the conference.  Other highlights include networking opportunities with leaders from the Visio product and program teams, robust partner and developer tracks with industry-specific content, demonstrations of powerful Visio solutions for business and IT needs and a preview of what’s to come in Visio 14. 


    Early Bird Registration rates are available now through November 30; go to to sign up.  Contact with questions or to learn more about sponsorship opportunities.


  • 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

    Publishing Visio 2007 Solutions


    Saul Candib, our technical writer for Visio, has posted an excellent article on MSDN explaining how to publish Visio 2007 solutions.  In this context "solutions" refers to the add-ons, templates, stencils and/or help files that you have created and want to distribute to other people.

    We covered this topic in a previous post, but the MSDN article goes into greater depth.  Saul describes the basic options of using path discovery (the classic way Visio content is found and usable in the application) or publishing content using Windows Installer (the method introduced in Visio 2003).  There is a good summary of the benefits of using Windows Installer, which is repeated here:

    • By publishing content, you can better integrate it into Visio. For example, you can more easily control the location of menu commands that start your solution or open your stencils, how the commands are named, and when they are available to users.

    • By publishing content, you can more easily publish localized versions of your solutions together with the Windows Multilingual User Interface Pack (MUI). (The MUI is a set of language-specific resource files that allow the user interface language to be changed, according to the preferences of individual users, to one of the 33 supported languages.)

    • Published content offers better performance, because published information is stored in the registry, where it can be retrieved more rapidly.

    • The Windows Installer Setup wizard is familiar to users and easy to use.

    • By publishing content, you benefit from Windows Installer repair and add-and-remove software features.

    • Publishing your content makes it available to all users of computers with multiple users. Path discovery works only for individual users.

    The bulk of the article explains in detail how to do publishing with Windows Installer.  There are a number of steps and tools involved, so you should find this write-up quite valuable.  The article is written for Visio 2007, but much of the information is applicable to Visio 2003.


  • Visio Insights

    Automatic Behaviors in Visio


    Several people have posted in the newsgroups about Visio moving shapes around unexpectedly - particularly when documents are opened or saved.  This random behavior can be infuriating to users.  Perhaps more frustrating is that Visio may continue moving shapes around after the user has "fixed up" their diagram again.  This post looks at automatic behaviors and tries to shine some light on the issues.


    Connector Routing

    Perhaps the most common automatic activity in Visio is connector routing.  Visio ensures that connectors stay glued to shapes when those shapes are moved around the page.  Visio also finds the optimum route for connectors that will avoid other shapes along the path.  Finally line jumps are added to connectors that cross over other connectors.  Historically, crazy connector routing has been a frequent complaint, but routing logic has gotten significantly better over time.  Recent versions of Visio do a pretty good job with routing.  While users may object to the routes chosen, there are very few reports of routes randomly changing in the diagram.




    If you are encountering routing issues in your diagram, you might find this earlier post helpful.  You can also reduce the number of situations where connector routes are changed.  Go to Format > Behavior and then the Connector tab and adjust the Reroute property.  Reroute = Never means that Visio will maintain glue but never recompute the route to optimize it.


    Solution Behaviors

    The second type of automatic behaviors involve Visio solutions.  In this case we are referring to the Visio add-ons that provide extra capabilities for individual diagram types.  For example, the Organization Chart solution is responsible for providing features such as dropping subordinates on top of managers, generating a diagram using the Organization Chart Wizard or synchronizing organizations across pages.  You may not think of these capabilities as add-ons because Visio tries to make the functionality seem as integrated as possible with the core diagramming features.

    Most frequently we hear about random shape movement with the Organizational Chart and Cross-functional diagram types.  However, users have reported issues with a number of diagrams such as Gantt Charts and Timelines too.  The root cause for random shape movement is that a diagram has solution managing the position of shapes, and something is triggering that solution to make it move shapes around the page.  These solutions get in trouble when they fail to realize that a shape’s current position has been designated by the user and is no longer under the complete control of the solution.

    Visio’s solutions that manage the position of shapes on the page can tolerate varying degrees of customization by the user.  Sometimes it is okay for a shape to be in a different location than what the solution wants, and sometimes the solution is not capable of leaving a shape in a different location.  Many problems arise when the user takes additional steps to prevent automatic behavior such as grouping shapes, replacing connectors with regular lines or disconnecting connectors.  This increases the likelihood that the “proper shape arrangement” according to the solution is not at all what the user intends.


    Remedies for Automatic Solution Behaviors

    There are two basic approaches to correcting a diagram that is “misbehaving”.  You can try to make the solution understand the diagram again.  This typically involves removing non-standard shapes and using the ones provided in the template.  It also means restoring connections between shapes using connectors and not lines.  The other approach is to disable the “intelligent” behavior of the solution and work with the diagram using core Visio capabilities only.  Depending on the drawing type and level of complexity in the diagram you may want the second option, although this is a more drastic measure.

    For Organization Charts, the typical cleanup is to delete the connections between shapes and then drop each subordinate on top of their manager again.  For Cross-functional Flowcharts, the typical cleanup is to drag each process shape outside the swimlanes and then drag them back in.  Unfortunately, none of these remedies is guaranteed.  There may be no way for a user to correct some situations.

    To disable a solution, you need to disable the Persisted Events that get stored in the document and trigger the solution whenever the document is opened in Visio.  Persisted Events can only be managed programmatically or through Visio’s XML file formats.  The Persisted Events tool in the Visio SDK is a great way to modify Persisted Events.  For those looking for something simpler, try pasting the VBA macros below into your document.  Run DisablePersistedEvents to turn off solution behavior for the document.  Run EnablePersistedEvents to turn solution behavior back on.


    Public Sub DisablePersistedEvents()


        Dim vsoEvent As Visio.Event


        For Each vsoEvent In ThisDocument.EventList


            If vsoEvent.Persistent = True Then

                vsoEvent.Enabled = False

            End If




    End Sub


    Public Sub EnablePersistedEvents()


        Dim vsoEvent As Visio.Event


        For Each vsoEvent In ThisDocument.EventList


            If vsoEvent.Persistent = True Then

                vsoEvent.Enabled = True

            End If




    End Sub



    Visio provides automatic behaviors to make diagrams much easier to create and manage.  When the automatic behavior matches your expectations, Visio feels like a very powerful tool.  When Visio seems to have a mind of its own, it becomes a frustrating application to work with.  The Visio Product Team is definitely interested in your experiences good or bad with the automatic behaviors in the application.  Your feedback helps us understand where we need to improve.


  • Visio Insights

    Data Graphics Tips


      One final post about Data Graphics before turning to other topics for a while.  We've gotten some great feedback from customers about their usage of Data Graphics.  Based on comments and observations of users, there are a few points of confusion that people are encountering.  This post explains the most common issues with the Data Graphics feature.



      I modified the data graphic on one shape and all my shapes changed

      Users encounter this when the same data graphic is applied to multiple shapes.  They select one shape and edit its data graphic only to find that the data graphic was updated on the other shapes as well.  When you edit the data graphic on a shape using the Edit Data Graphic command, you are actually changing the definition of the data graphic used everywhere.


      If you really want to change the data graphic on some of the shapes, you need to assign a different data graphic to those shapes so that they act independent of the rest.  Go to Data > Display Data on Shapes to open the Data Graphics task pane.  Right-click on the data graphic currently applied and click Duplicate.  Then select the shapes you want in the drawing and click on the duplicate data graphic to apply it.  You can continue to modify the new data graphic and only affect the shapes you chose to apply it to.




      How do I switch between Text Callouts and Data Bars?

      With Data Graphics you can display information using Text Callouts, Data Bars, Icon Sets or Color by Value.  These are the choices when adding new items in the Edit Data Graphics dialog.  Unfortunately, once you choose the type of graphic for an item, you cannot switch to one of the other types.  This is a limitation of the feature.  You will have to delete the item you have and add a new one with the type you want.




      Sometimes I can't select the data graphic in the diagram

      Visio adds data graphics to shape in the diagram by inserting them as sub-shapes of the target shape.  The ability to select the callout sub-shapes is then dependent on whether the target shape allows it.  Go to Format > Behavior and look at the Selection property.  "Group only" means that sub-shapes cannot be selected.  Change this to "Group first" or "Members first" to all selection.  A common reason to select callout sub-shapes is to apply local formatting to them.




      My Data Bar doesn't show the correct percentage value

      The default Minimum and Maximum values for a Data Bar are 0 and 100.  This makes it seem like the Data Bar naturally displays percentage values with 100 being the largest data value and 0 being the smallest data value.  However, that is not how Data Bars work.  The Min and Max properties are actual values.  If your data field has values in a different range, you need to update the Min and Max properties to match your data range.




      How do I reset the position control handle?

      Visio adds a control handle to target shapes for easy repositioning of the data graphic.  This allows you to customize the location of the data graphic on a shape-by-shape basis.  Changes to the position property in the data graphic definition do not override the custom position you designate. 


      If you would like to reset the position control handle so that it uses the data graphic position property, you must remove the data graphic and reapply it.  Go to Data > Display Data on Shapes to open the Data Graphics task pane.  Select your shape and choose the None data graphic.  Then click on the previous data graphic to reapply it.




      Data graphics don't appear when I apply them to pictures or images in my diagram

      Data graphics cannot be applied directly to pictures or embedded objects.  Visio is unable to convert these shape types to groups so that callouts can be inserted.  The typical workaround in this case is to group the picture or object and then apply the data graphic to the group.  You also have to move your data to the group shape.  There is a KB article explaining the procedure:



      Want to know more about Data Graphics and visualizing information?

      If you have mastered the basics and want to go further with Data Graphics, there's a new book available for Visio 2007.  The book is Visualizing Information with Microsoft Office Visio 2007 by Visio MVP David Parker.  You can read a review of the book on Chris Roth's Visio Guy blog.


  • Visio Insights

    Make Your Own Data Graphic – Icon Sets


    This is the third and final 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.  Data Bars were described in the second post.  There is also an article on MSDN that covers the full spectrum of customization possibilities for Data Graphics.




    An Icon Set is one of the four ways you can visualize data using Data Graphics.  It shows information in a compact, visual form.  Icon Sets are used to convey “state” – whether some condition in the data has been met.  An Icon Set may be used to indicate exception conditions such as displaying a red flag next to a shape to indicate a problem.  Alternatively an Icon Set shows one of several possible conditions present in the shape data such as in the image above showing completion state. 

    A Data Graphics Icon Set can contain up to five icons.  There are two general approaches to Icon Set callout construction.  One option is to assemble five bitmaps into a shape and add logic to show the correct bitmap based on the data.  This approach is described in the MSDN article along with guidance how to do this efficiently by making an image strip.  A second option is to create the callout using Visio geometry and formatting.  This approach follows the multi-shape concept in Visio where the data controls the visibility and formatting of portions of the shape.  We will use the geometry approach for this post.

    Our sample Icon Set callout is a torus or doughnut shape.  There are five possible states indicating how much of the doughnut is shown.  Technically, an Icon Set can have six states, but by convention the first state is the “not shown” state.  If the icon was intended to have some residual visual state, an image could be assigned to the “not shown” state.  Each state in the icon set corresponds to a geometry section in the shape that can be made visible when appropriate.  Also the fill color of the icon set changes with each state.  Let’s start with the minimum set of tasks to create a Data Graphic callout and then add functionality from there.

    We draw a circle on the page and open its Shapesheet.  In the Shapesheet, we need to insert a User-defined section for the Icon Set properties.  Three cells are required for Icon Sets.  User.msvCalloutType identifies the shape as a Data Graphic callout of type Icon Set.  User.msvCalloutIconCount tells Visio how many icons or images are in the set.  This can range from 1 to 5.  User.msvCalloutIconNumber tells Visio the default icon to show in thumbnails of the data graphic.  Once the callout is applied to a shape, Visio uses this cell to tell the callout which icon to show.




    This is all that Visio requires for a usable Icon Set callout.  If you drag this shape over to the document stencil and then make a new data graphic, you would see this callout appear in the Edit Icon Set dialog.  However, we have five icons that show the same circle.  Our next task is to add the real geometry that makes up the five icons in the set.

    Our callout shape has one geometry section already.  This circle will be the outer edge of the doughnut.  We need a second circle for the inner edge.  We could draw this circle with the drawing tools, but we don’t want to create a new shape here.  All of the geometry will exist in a single callout shape.  The easiest method is to add the required geometry directly in the Shapesheet window.  Note that circles are represented using the Ellipse section type.  After inserting the new section, we update the A and D cells to set the size of the circle.




    Now let’s tie the geometry to specific icons in the Icon Set.  User.msvCalloutIconNumber controls which icon should be displayed.  The index is 0-based, giving us a 0 to 4 range to work with.  Additionally, Visio uses the value -1 to indicate that no icon should be shown.  As a best practice, we will not show any icon for any value outside the 0 to 4 range.  If we glance back at the example at the top of the page, we see that the full doughnut geometry is intended to be shown for index values 0 and 4.  A partial doughnut is shown for index values 1, 2 and 3.  Our two geometry sections should only be visible when the index is 0 or 4.  We control the visibility through this formula added to the NoShow cell for each section.

    Geometry1.NoShow = IF(OR(User.msvCalloutIconNumber=0,User.msvCalloutIconNumber=4),FALSE,TRUE)

    Geometry2.NoShow = IF(OR(User.msvCalloutIconNumber=0,User.msvCalloutIconNumber=4),FALSE,TRUE)

    This is a common expression for Icon Sets.  The OR function can have any number of conditions in it, so showing the geometry section for an additional index value would be as simple as adding one more condition to the OR function arguments.  We can test our expression by typing various numbers into User.msvCalloutIconNumber to see geometry appear and disappear.

    We need an additional geometry section for each of the partial doughnut icons.  You need to understand a little about how Visio defines elliptical arcs to get the geometry formulas correct.  The basic idea is that you must specify the end point of the arc as well as a point along the arc’s path.  Also note that changing the row type of a path (to switch from LineTo to EllipticalArcTo) can reset the shape’s alignment box.  We need to prevent that by setting the LockCalcWH cell to 1 in the Protections section first.  Here are the three geometry sections needed:




    To display these icons at the right time, we need to tie their NoShow cell to User.msvCalloutIconNumber.  Here are the expressions for geometry sections 3, 4 and 5 respectively:

    Geometry3.NoShow = IF(User.msvCalloutIconNumber=1,FALSE,TRUE)

    Geometry4.NoShow = IF(User.msvCalloutIconNumber=2,FALSE,TRUE)

    Geometry5.NoShow = IF(User.msvCalloutIconNumber=3,FALSE,TRUE)

    Now our callout shape shows the correct geometry for each value of User.msvCalloutIconNumber.  Next we will make the fill color change with the index value as well.  Our doughnut should be white for index 0, a reddish color for index 1 and a green color for index 4.  Between 1 and 4 the color transitions from red to green.  This is accomplished by using the BLEND function.  For BLEND the two color extremes are specified along with a value between 0 and 1 to determine the balance between the colors.

    FillForegnd = IF(User.msvCalloutIconNumber=0,1,BLEND(RGB(208,81,81),RGB(146,208,80),(User.msvCalloutIconNumber-1)/3))

    Once the color is set up, we set the LockFormat cell to 1 to prevent changes by the user or theming.  Our callout now produces all the icons as intended.  One final step is to lock down the size of the callout shape so that it does not stretch when applied to a target shape.  The following formulas are added to the Width and Height cells.  Note that DropOnPageScale allows the icon to work in both scaled and unscaled drawings.

                    Width = GUARD(0.25 in*DropOnPageScale)

                    Height - GUARD(0.25 in*DropOnPageScale)

    This callout shape is complete and can be dragged into the Document Stencil to create a master shape.  If you open the Data Graphics task pane (Data > Display Data on Shapes) and create a new data graphic, you can add a new Icon Set to see that the callout is available for use.  One item to point out is that the second icon is shown at a different scale than the others.  For the preview image, Visio zooms to fit the visible geometry into the available image size.




    We can continue to embellish the callout shape if desired.  It would be nice to set up the geometry of the icons so that it does not extend all the way to the edge of the callout shape.  Leaving a small margin makes everything look better when Visio stacks several Icon Set callouts on top of each other.  This requires changes to the geometry expressions to account for margin.  An example of this can be found in the attached Visio document.

    This concludes our series on building custom Data Graphic callouts.  There are more tips and tricks about Data Graphic callout construction in the MSDN article.  If you would like to see more on this feature or other Visio 2007 features, please send us an e-mail or post a comment.


  • 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

    Make Your Own Data Graphic - Text Callouts


      Data Graphics is a great new feature in Visio 2007 Professional for displaying data on your shapes.  One key to the feature's popularity is that you can make or customize your own data graphic callout shapes. There is an article posted on MSDN that covers the full spectrum of customizations possible for Data Graphics.  Also check out this post that discusses customizing a data graphic callout.  In this post we're going to create a text callout from scratch.




      A text callout is one of the four ways that you can visualize data using Data Graphics.  It performs the basic role of showing data as text labels on the diagram.  In the picture above, there are four text callouts to the left of the Server shape and one below the shape.  Some callouts display just a value; others include a field label.  The formatting and geometry are as customized as you want to make them.


      To create a brand new text callout, we need to create a shape with the look we want and then configure it to work with the Data Graphics feature.  For this example we'll do just the minimum steps needed to get things working.  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.




      There are just two things needed 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 "Text Callout" - including the quotation marks here.  Second, change the row name of the Shape Data row to Prop.msvCalloutField (click on the row name and type "msvCalloutField").


      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 Text / Edit Text 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.  To make it easier to continue building the shape, you may want to put some text in the Value cell to serve as sample data.


      What's missing from this shape is the actual display of the data as text.  This is typically done using Text Fields.  With the shape selected in the drawing window, go to Insert > Field and choose the msvCalloutField in the Shape Data category.




      Now we can test this shape.  Drag it into the Document Stencil to create a Visio Master shape.  Give the master a name.




      Now drop a shape on the page and give it some data.  The Basic Flowchart Shapes are a good test bed since they have three built-in Shape Data fields.  You can right click on the flowchart shape and choose Data > Shape Data to fill in some values.  Now right click again and choose Data > Edit Data Graphic to create a new data graphic with your callout.




      Because we set the User.msvCalloutType to "Text Callout", we need to go to New Item > Text.  In the New Text dialog open the Callout dropdown to see the custom callout shape we made.




      Choose the custom callout and then a Data field to display in the callout.  Finally click OK twice to see the callout applied to the flowchart shape as a data graphic.




      Go ahead and change the Shape Data in the flowchart shape to see it update in the data graphic.  Now we have a functioning text callout.  What remains is whatever customizations you want to make to enhance the visual appearance of the callout.  Perhaps you want to apply formatting or tailor the geometry.  Perhaps you want to add configurable settings that the user can select in the New Text / Edit Text dialog.  See the MSDN article for more information about adding this functionality.  As always, you can look at the callouts that are built into the Data Graphics feature for examples of more sophisticated behaviors.


      If you have some suggestions for new data graphic callouts, post a comment.  We'd like to hear from you.  In the next post we will look at an example for Data Bar callouts.


  • Visio Insights

    New resources for Visio


    Our MVP community has been quite busy creating new resouces for Visio.  We'd like to highlight a few recent releases here.



    In response to a newsgroup discussion on Visio's Network Rack shapes. Chris Roth (Visio MVP and former employee) has released a new shape for displaying rack unit dimensions.




    Second, the latest version of the Work Breakdown Structure (WBS) Modeler add-in has been released.  To quote from the add-in description: 


    "The Microsoft Office Visio 2007 WBS Modeler is intended to improve the project planning process by giving the opportunity to generate Project Plans from a Work Breakdown Structure (WBS) using a graphical representation of elements.


    The Application enables effective integration of Microsoft Office Visio 2007 with Microsoft Office Project 2007. It provides an approach to visually and graphically create, edit and modify project plans using Visio 2007."




    Finally, there are new training materials for Visio 2007 solution development.  Here is the summary for the download:


    "Gain deeper technical skills around Visio 2007 solution development. The Visio 2007 Solution Development Workshop is a free to download, self paced instructional guide covering the concepts and techniques needed to develop Visio based data visualization solutions. The content of this workshop maps to the main themes of the upcoming Visio MCP examination, makes for an excellent readiness resource and provides partners with the skills to start build data Visualization solutions today."



  • Visio Insights

    Creating Visio Add-ins with VSTO 2005 SE


    There have been several newsgroup postings about using VSTO to create Visio Add-ins.  The deployment of these add-ins can be especially challenging.  There is a new developer article by Chris Castillo detailing how to write VSTO add-ins for Visio.  Chris explains why using VSTO is desirable and aggregates information from a number of sources to walk you through the development and deployment process.




  • Visio Insights

    Where's my text control handle?


    A Visio user posted a question in the newsgroups about the yellow text control handle on connector shapes.  Some connectors have a yellow handle and some don't.  What's going on?

    Starting in Visio 2003, the built-in connector shape used by the Connector Tool was modified to include a text control handle.  If you start a blank drawing and click on the Connector Tool you should get this version of the shape.  Note that you must enter text on the shape before you see the text control handle.  This shape is named the Dynamic Connector. 

    There are also a number of Visio stencils with a Dynamic Connector shape such as the one in the Basic Flowchart Shapes.  Unfortunately, many of these shapes were not updated with the new text control handle.  Diagrams created in previous versions of Visio would have connectors that did not have the text control handle either.  Furthermore, once you have any shape named Dynamic Connector in the document, Visio will use that shape for the Connector Tool.

    All is not lost!  The text control handle behavior is relatively simple and can be added to any existing shape or master.  Here are the steps.  Go to File > Shapes > Show Document Stencil and double-click on the Dynamic Connector master shape.  Select the connector in the edit window and go to Window > Show Shapesheet.  Then go to Insert > Section and choose the Controls and Text Transform sections if they are enabled.  Click OK.  Now enter formulas in the cells as shown in the screenshot.  The downside of this is that connectors already on the page won't pick up all the behavior because they have some local formulas.

    But there is an even better solution.  Download the attached Visio document to get a macro that will fix up your masters and shapes automatically.  The macro is designed to work on the active document.  Load the macro document, enable macros if you get a security warning, then switch back to your document and go to Tools > Macro > TextControlHandle > ThisDocument > AddTextControlHandle.  The macro looks for connectors that do not yet have a text control handle and sets one up.  The macro doesn't quite fix everything.  It doesn't dive into groups looking for connectors to fix.  You should now be able to draw with the Connector Tool and get text control handles.  Note that dragging out a Dynamic Connector shape from a stencil will give you the old connector not the new connector, so stick with the Connector Tool.

    Thanks for the great newsgroup question!



  • Visio Insights

    Custom Formulas in Data Graphics


    Judging from the page view statistics on the blog, Data Graphics is a topic of interest to a number of people.  For those interest in the previous post on building custom data graphics, look here.  In this post we’ll look at another way to get more out of the data graphics you create.  Our example will focus on the sales data for a fictitious furniture company.  Our goal is to use Data Graphics to show financial data about each product.

    We have data for the Product Name, Revenue and Expenses associated with a number of furniture products.  A first attempt at a data graphic might look like this:


    The Product Name is shown as a text callout.  Revenue and Expenses are shown using data bars.  It would be really helpful to see our profit for each product.  That value isn’t part of the data, but we can easily calculate it.  Data Graphics supports a wide variety of custom formulas for situations where the data value is not explicitly stored in a Shape Data field.  Let’s create a new text callout to show Profit and see how to specify a custom formula.


    In the Data field dropdown, pick the More Fields option at the end of the list.  Then in the Field dialog choose Custom Formula in the Category list.  Enter the expression ={Revenue}-{Expenses} in the formula box.


    The profit is calculated by subtracting the Expenses from the Revenue.  To use other fields in the custom formula, wrap the field names in curly braces.  (Technically, the field name corresponds to the Label cell of a Shape Data row for that field.)  When Visio applies the data graphic, it figures out what Shape Data fields to use in the custom formula and creates the proper Shapesheet formulas in the callout.  You can enter almost any valid Shapesheet expression in the Custom formula box.

    One the field is selected, it is useful to set the value format and label properties of the text callout.  The final property values are shown below.


    There’s one more thing to make this a great-looking diagram.  If you notice in the original image, the data graphic is too close to each shape.  Our furniture shapes spill outside their bounding box a bit, making the diagram look cluttered.  There is a User-defined cell (User.msvDGCalloutGap) in the Pagesheet that controls the spacing between shapes and data graphics.  By making this value larger, we increase the spacing.


    Here is the final result with our custom formula and custom spacing:


    Please post your comments and questions about Data Graphics in Visio 2007.  If you have a suggestion for another blog post on the subject, just let us know.


  • Visio Insights

    Make Your Own Bubble Chart, part 3


    This post is part of a series examining Bubble Chart diagrams.  We are building a Bubble Chart stencil from scratch to make diagram creation easy for the user.  You can get the completed stencil from the first post in the series.  In the previous post, we completed the Bubble Chart master shape.  This shape is the background for the chart.  In this post we will build the Bubble Data master shape.  Bubble Data shapes are placed on top of the chart to display information.


    Bubble chart 


    The Bubble Data shape will hold the data provided by the data source (via Visio 2007's Data Link feature).  The data will define the X and Y position for the shape.  It will also define the Size of the shape.  We will use a circle as the basic geometry for the shape and set the diameter of the circle according to the Size property.  The shape will also display a Label and the Size as text using Visio 2007's Data Graphics feature.


    The final location for a Bubble Data shape is dependent on its own data plus information about the size and position of the Bubble Chart shape on the page.  Without resorting to code, the Bubble Data shape does not have an explicit reference to the Bubble Chart shape.  We are using the page itself as an intermediary.  The Bubble Chart shape pushes its settings to the page, and the Bubble Data shape will reference those settings.  We need to add the same User-defined cells from the Bubble Chart's Pagesheet to the Pagesheet of the Bubble Data shape.  There is a quick way to copy this information over.  Double-click on the Bubble Chart master shape to edit it.  Select the rectangle shape and copy it to the clipboard.  Close the edit window and double-click on the Bubble Data shape.  Paste the rectangle shape and then delete it.  What did this accomplish?  Go to Window > Show Shapesheet to look at the Pagesheet for the Bubble Data master.  All the User-defined cells were copied over from the Bubble Chart master.




    Next draw a circle on the page and go to Window > Show Shapesheet.  The circle shape will use Shape Data to store the linked data and User-defined cells to calculate the actual position on the page.  Go to Insert > Section, check Shape Data and User-defined cells, then click OK.  We need four Shape Data properties, so right-click in the Shape Data row and choose Insert > Row three times.  Create named rows for BubbleX, BubbleY, BubbleSize and BubbleLabel.  The row names will be referenced in the position calculations.  The Label cell in each row must match the field name used in the data source.  In our example, we are standardizing on the field names X, Y, Size and Label.  If you want to use different names in the data source, change the Label strings here.  Set Type = 2 for the first three rows to identify the Shape Data as numeric.  The final row is left as 0 for a string type.  Then enter some initial values to see the bubble work while you build it.  The values will be overwritten by real data in the diagram.




    Three User-defined cells are needed to calculate the page coordinates for the X, Y and Size properties.  Right-click in the User-defined row and choose Insert > Row twice.  Create named rows for BubbleXPage, BubbleYPage and BubbleSizePage.  The formulas for these cells are lengthy, so they are listed here:


    BubbleXPage =



    BubbleYPage =



    BubbleSizePage =

    (Prop.BubbleSize/ThePage!User.ChartSizeFactor)*1 in




    What's going on?  We are using a ratio to calculate the position of the bubble shape.  Given the ratio of the data value between the chart min and max, we can apply the same ratio to the page coordinates of the chart min and max.  The result is the page coordinates for the shape.   A simpler ratio is used to calculate the size of the bubble in page units.  Once we know the coordinates, we can reference them from the Shape Transform section as shown below.




    This completes the functional part of the Bubble Data shape.  Next we turn to the data displayed using Data Graphics.  Right-click on the shape on the page and go to Data > Edit Data Graphic.  Click on New Item and choose Text.




    In the New Text dialog, choose Label from the field list.  Then choose the Heading 2 callout.  Set the Border Type to None to display just the text.  Click OK to close the dialog.




    We want the Label field to appear below the bubble shape.  In the New Data Graphic dialog set the default position to Center, Below Shape.  Now add a second text callout using New Item > Text.  Choose Size for the field and Circle callout for the callout.  Set the border and fill to None.  Also set the Value Length to 0.  This eliminates truncation of the displayed values.  Finally we want this field to be displayed in the middle of the bubble shape.  Uncheck the Use default position box and set the callout position to Center, Middle.  Click OK to close the dialog.




    This completes the data graphic for our Bubble Data shape.  Click OK to close the dialog.




    As a final touch, apply a fill color to the circle to make it work with the Theme feature in Visio 2007.




    Our Bubble Chart and Bubble Data shapes are now finished.  All that remains is to create a data source with real data in it.  Excel is a great choice.  Place the Label, X, Y and Size heading at the top and fill in the data.  You can add other columns as well.  These will be linked as Shape Data and can be displayed if you further customize the data graphic on the Bubble Data shape.  Refer to the first post in the series for a walkthrough from the user's perspective.


    Hopefully you've gotten a good insight into the data connectivity and visualization features in Visio 2007.  We combined these features with some intelligent shape design to create a new diagram type for Visio.  We can automatically build a diagram from data, and we didn't have to write any code to do it.


Page 5 of 8 (181 items) «34567»