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 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
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.
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?
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.
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.
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 has published the XML Schema Definition (XSD) files for the Microsoft Visio 2010 XML Drawing (.vdx) format. This schema is also known as DatadiagramML. The .XSD files allow developers to better understand the structure of Visio XML documents and design solutions that work with the .VDX file format.
The DatadiagramML Schema for Visio 2010 consists of three .XSD files:
More information about the schema is available in the Visio 2010 XML Schema Reference on MSDN.
Do you work directly with Visio XML files? We’d love to hear about your scenarios in the comments.
Shape control handles offer users convenient ways to take advantage of the intelligence built into the shape by a designer. Perhaps the most common use for a control handle is to link it to the text on a shape. While Visio provides the Text Block Tool for manipulating shape text, this tool is not very discoverable (it’s underneath the Text tool in the Standard toolbar) and is cumbersome. A control handle is a very convenient alternative. In fact, Visio 2003 has a text control handle built into the default dynamic connector.
The dynamic connector incorporates a couple of behaviors that you may find helpful in the design of your own shapes:
· The control handle is not shown unless there is actual text in the shape
· The user can use either the control handle or the text block to reposition the text
Let’s look at the Shapesheet for a dynamic connector to see how these behaviors are implemented.
The visibility of the control handle is determined by the X Behavior cell. This cell describes how the control handle should resize with the shape, whether it can be moved at all and whether the control handle is visible. An IF statement sets the behavior to 5 to hide the handle or 0 to show it. The conditional statement verifies that the shape has no text or that it is currently not visible. Note the use of the STRSAME function to check for text. This is the recommended practice.
The synchronization of the control handle and text block is accomplished using the SETATREF function. This is a very powerful and complicated function that needs some introduction. We’ll look at the basic capability as it is used in the text control handle here, but there is quite a bit more to cover in a future post.
Consider a typical formula dependency where cell A depends on cell B. As long as the user modifies cell B, then A and B will both be up to date. What happens if the user modifies cell A? This change would blast the formula in cell A, decoupling it from cell B. You could GUARD the formula in cell A to preserve the dependency on cell B, but now the user cannot manipulate cell A at all. SETATREF solves this problem by preserving dependencies and forwarding inputs to the independent cell. SETATREF allows cell A to depend on cell B while also allowing the user to change either A or B.
In the case of the text control handle, the position of the text block is dependent on the position of the control handle. Thus the TxtPinX and TxtPinY cells have formulas with references to Controls.TextPosition and Controls.TextPosition.Y respectively. These references are then wrapped by a SETATREF formula. To understand how SETATREF works, we need to separate what happens during recalculation versus what happens during cell input.
Because TxtPinX and TxtPinY have formulas with references to the control handle position, these cells must be recalculated whenever the control handle position changes. During the recalc operation, the SETATREF function is transparent. SETATREF(x) = x. In other words, the result of the recalc is just like if there were no SETATREF wrapped around the cell references. On the other hand, when the user directly manipulates the TxtPinX or TxtPinY cells (by using the Text Block Tool), SETATREF influences how the new value updates the Shapesheet. Rather than letting the new cell value replace the SETATREF formula, Visio forwards the value to the cell referenced in the SETATREF function. Thus any change to the TxtPinX or TxtPinY cell is actually made to the Controls.TextPosition or Control.TextPosition.Y cell instead. Then the TxtPinX and TxtPinY cells pick up the change through recalculation.
This ability to preserve dependencies and forward input values is extremely versatile for shape development. We’ll look at some more sophisticated uses for SETATREF in a future post.
A common newsgroup question is how to prevent the Template Help task pane from appearing every time a document is opened. Not only do we see lots of newsgroup posts about this, it turns out that one of the more common pieces of feedback we receive through Rate this Template is “Let me disable this task pane”.
Here are the steps to disable automatically showing the task pane:
1) Go to Tools > Options in the menu
2) Click on the General tab and choose Service Options at the bottom
3) Select the Online Content category and uncheck “Show Template Help automatically…”
The task pane is intended to help people learn more about various diagram types. Unfortunately the design tends to focus on the initial usage experience (having the template help in your face) at the expense of ongoing productivity (having lots of drawing space). Perhaps the biggest problem is that there is no place on the task pane itself to disable the automatic behavior.
The good news is that there is no Template Help task pane in Visio 2007. There is a link to template help at the bottom of the Getting Started screen. It is grouped with all the other content available from Office Online. Hopefully this is a better location both for those that want to find template help and those that do not want to be bothered by template help.
March Madness is about to start, so here’s a Visio diagram to let you quickly fill out and share your bracket! Download the diagram here, and with a few clicks you can have a complete professional looking bracket that you can easily share with others. This diagram was originally created by Visio MVP Chris Roth, who runs the Visio Guy blog.
The bracket has the first 64 teams already filled out. All you need to do is select the winners. You can fill out the bracket using Visio in one of the following ways:
When you enter the score in the shape data window, the shapes will update and propagate the winner to the next level in the bracket.
Note: the 8 teams playing in the first round are playing on 3/15 and 3/16, so you’ll need to update the bracket once those teams are decided. In the bracket, those teams are highlighted with a red asterisk so you don’t forget.
Chris Roth’s original diagram can be found on his blog here: http://www.visguy.com/2009/03/16/ncaa-final-four-interactive-visio-tournament-bracket/ He originally created this diagram during the 2009 tournament, and we updated it with the 2011 teams.
Hope you enjoy this year’s tournament, and good luck filling out your brackets. As always, let us know if you have any feedback or suggestions.
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.
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:
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.
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 started working on the Bubble Chart master shape. It captures configuration information from the user when the shape is dropped on the page. The information along with the chart shape's boundaries are stored in properties on the page. Now we will complete the shape by adding the chart labels.
Double-click on the Bubble Chart shape in the stencil to edit it again. There are seven labels on the chart: the title, two axis labels and four axis range boundaries. Visio only allows one text block per shape, so we need seven shapes to display all the text. Our rectangle will hold the text for the title. The remaining shapes will be added as separate text boxes. Select the rectangle and type some default text such as "Bubble Chart". The text is centered horizontally and vertically by default. We want the text to appear above the shape.
Shape text is positioned according to the Text Transform section of the Shapesheet. Go to Window > Show Shapesheet to open the Shapesheet window. Then go to Insert > Section, choose Text Transform and click OK. We need to change the properties associated with the Y coordinate of the text block. To put the text at the top of the chart, set the TxtPinY cell equal to the shape height. To make multi-line text grow away from the shape, set the TxtLocPinY cell to zero (note the way this is represented in the picture). Finally, to keep the text box sized according to its text contents, set the TxtHeight cell equal to the height of the text. Enter the formulas as shown in the picture below.
The default text size can be set in the Shapesheet as well. Find the Character section and set the Size cell to 24 pt.
Next we need to add more shapes for the other labels. The rectangle will be a group shape and the other shapes added as sub-shapes. First, we need to lock the rectangle so that it does not change shapes are added. Find the Protection section and set LockCalcWH to 1. When shapes are added to a group, Visio will recalculate the boundaries of the group to encompass the new shapes. We want our rectangle to define the group boundary and place the labels outside. LockCalcWH prevents Visio from redefining the group boundary. Also lock the rectangle from rotation since our formulas assume no rotation.
Now we can make the group. Close the Shapesheet window. Then choose Shape > Grouping > Convert to Group. Go to Insert > Text Box and draw a text box on the page. Visio will enter text edit mode and display a flashing caret. Go to Insert > Field and click on the Custom Formula category. Enter a formula referencing the minimum X value of the chart. Sheet.5 is the reference for the rectangle shape. Prop.ChartMinX is the reference for the Shape Data value. Press OK to close the dialog and click away from the shape to exit text edit mode.
Select the rectangle and then Shift+click the text box to select it as well. Go to Shape > Grouping > Add to Group. The order of selection is important. Now the text box is part of the group. Sub-select the text box and go to Window > Show Shapesheet. We need to lock the text box into the correct position around the rectangle. Also the text box should grow to fit its contents. Fill in the Shape Transform section as shown in the picture below. Note the change to the LocPinX and LocPinY to make the text box grow down and to the right.
We need to repeat this process five more times to add the remaining text labels. Here are the remaining field formulas and Shape Transform sections:
Field formula = Sheet.5!Prop.ChartMinY
Field formula = Sheet.5!Prop.ChartMaxX
Field formula = Sheet.5!Prop.ChartMaxY
Field formula = Sheet.5!Prop.ChartXAxisLabel
Field formula = Sheet.5!Prop.ChartYAxisLabel
As a final touch, apply a fill color to the rectangle to make it work with the Theme feature in Visio 2007. Choose a very light color such as 5% Gray or 35% Tint on an Accent Color. The Bubble Chart shape needs to contrast with the Bubble Data shapes we will place on top.
This completes the Bubble Chart shape. We will build the Bubble Data shape in the next post.
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:
In the above functions:
To give you an idea of what you can do with these functions, we'll explore three examples.
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:
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:
Here’s how we setup the triangle to do this:
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.
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:
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:
As usual, please tell us what you think by using the Send a Smile feedback tool or by commenting on this post.
Yesterday, we released Service Pack 2 (SP2) for Visio 2007. You can download and install it from:
Among the issues we've addressed in SP2 are these:
In addition, SP2 provides these new capabilities:
We on the Visio product team receive lots of interesting questions from Visio users through our blog’s contact form. In this post, we’ll share our answers to several questions that we thought would be of interest to our blog readers.
Q: I installed Visio 2010, but the BPMN shapes appear to be missing. Where can I find them?
A: The BPMN shapes are part of Visio Premium 2010. You can check what edition you have by going to File > Help and looking in the top right.
Here is a link to the feature set for each Visio edition:
Q: If I add hyperlinks to my Visio drawing, will they still work after using Visio Web Access to display them on a SharePoint page?
A: Yes, hyperlinks will work in the Visio Web Part. Here are some more details:
Q: I upgraded to Visio 2010 and am having difficulty finding the Shape Operations (Union, Combine, Fragment, Intersect, Subtract, Join, Trim, and Offset). Where are they?
A: In Visio 2010, Shape Operations have been moved to the Developer tab of the Ribbon, which you can enable by turning on Developer mode in Visio Options:
Once this is done, click on “Operations” in the Developer Tab to get the menu of operations:
Q: I am creating a Visio 2010 Cross-Functional Flowchart. How can I select an individual band to specify its color fill?
A: The easiest way to select a band (also called swimlane) is to click on its text heading, so that you see a dotted outline around the swimlane. You can then choose a fill color, and that will apply to the heading portion of the band, as follows:
To apply the fill to the body of the swimlane, go to the Cross-Functional Flowchart tab in the Ribbon and select a style in the Style gallery that has a fill:
This lets you color the whole swimlane as follows:
Q: Where can I get support for Visio or report a problem?
A: The central support place for Visio is the Visio Solution Center. It allows you to get product information, get self-support or community support, or contact a support representative.
If you simply want to report a problem, you can choose one of the community support options such as the forums or our contact form. If you want help finding a resolution, you should choose the forums or contact a support representative.
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.
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
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.
In our last post, we discussed Diagram Validation—a new Visio 2010 feature which allows users to check their diagrams for common errors and allows companies to ensure that employees are following certain diagramming standards. In this post, we’ll talk more about how validation rules are stored and how to create custom validation rules.
With Visio 2010, we provide diagram validation support for Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation diagrams. We also provide an extensive validation API for creating custom validation rules. The supported functionality includes adding and deleting rules and rule sets, directly manipulating validation issues, triggering validation, and detecting the validation event. This support allows companies to develop custom validation rules to meet their own needs.
At a high level, validation rules belong to rule sets, such as the Flowchart and BPMN rule sets. To see which rule sets are available in your current diagram, click the Check Diagram pull-down menu on the Process tab, and then click Rules to Check. Rule sets with a checkmark beside them are active—rules from these sets will be evaluated during validation. Clicking on a rule set will toggle it between active and inactive.
There are two main approaches to creating custom validation rules and rule sets.
1. You can write validation rules and validation logic that will be stored in a custom Visio template. These rules are automatically available to users that create diagrams based on this template. When a user clicks Check Diagram on the Process tab, Visio uses the validation logic provided to determine whether the diagram has issues. In Visio 2010, this technique is used for the Basic Flowchart, Cross Functional Flowchart and Business Process Modeling Notation templates.
2. You can also write validation logic in code and deploy this logic as part of a Visio solution. For this approach, the solution code listens for the appropriate RuleSetValidated event and uses its own logic to determine the list of issues to add to the document. In Visio 2010, this technique is used for the Microsoft SharePoint Workflow template.
In both cases, the validation rules and corresponding rule sets are stored inside your Visio file. To see how these rules are stored, you can save a Visio file with validation rules as an XML Drawing (*.vdx) and open the XML Drawing in an XML editor. A search using the keyword “validation” will lead you to the XML related to validation. In the image below, a section of the XML for the Flowchart rule set is shown.
Notice that each rule in the Flowchart rule set contains a RuleFilter and RuleTest property. These properties define the logic that Visio uses to determine whether a rule applies to a particular Visio object, and whether the rule is satisfied by the object. The syntax for each logic expression is the same as a ShapeSheet expression, but the allowable functions differ slightly. You can see many examples of valid RuleFilter and RuleTest expressions in our Flowchart and BPMN rule sets.
If you save a Microsoft SharePoint Workflow diagram as an XML Drawing (*.vdx) and open the XML Drawing in an XML editor, you will see that there is no logic in the RuleFilter and RuleTest expressions. In this case, the solution contains code with the validation logic. The SharePoint Workflow solution listens for the SharePoint Workflow RuleSetValidated event, and, when this event occurs, it scans the diagram to determine if there are issues. When an issue is found, it uses the validation API to add the issue to the document. Visio automatically displays these issues in the Issues Window.
Although you can modify the validation properties directly in the XML, we suggest that developers use the validation API to manipulate rules programmatically. You can use Visual Basic for Applications, accessible through the Developer tab, and its Object Browser to view the validation API. The key objects, methods and properties for validation are shown below.
There is a lot more that can be said about creating custom validation rules, but hopefully this post gives you a good sense of the options available for using Diagram Validation. The following list summarizes these options.
1. End-users and companies can use the default rules provide in Visio 2010 to check their diagrams for issues and ensure diagram consistency. Out-of-the box support is included for Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation diagrams.
2. Developers can extend the out-of-box support by creating custom templates with validation rules. These rules are available to users who create diagrams from these templates.
3. Developers can create Visio solutions that listen for the validation event. When the Check Diagram button is clicked, the solution can run code to validate complex logic and use the validation API to add issues to the list of issues displayed in the Issues Window.
4. Developers can create Visio solutions that trigger validation from within their code. This allows solutions to make use of validation without relying on a click of the Check Diagram button. For example, the Microsoft SharePoint Workflow template triggers validation when a user clicks the SharePoint Workflow button Export on the Process tab.
We’re interested to hear your feedback, so use the Send a Smile feedback tool or comment on this post to let us know what you think.
Over the past few weeks Microsoft has released a ton of resources to help administrators and end-users get started with Visio Services. This article summarizes all the online resources for Visio Services in one place.
Visio Services is a new feature in SharePoint 2010 that allows you to view and share dynamic, data driven diagrams. For a quick refresher on Visio Services, see this blog post.
To help administrators setup and configure Visio Services, we’ve put up a set of instructional videos that will guide you through various setup and configuration tasks. The videos cover basic setup, as well as how to configure Visio Services to connect to external data sources.
The second and third videos below also show you how to create a data connected diagram in Visio 2010.
Note: these videos are .WMV files, so you can click them to stream them, or right click and choose to save them locally.
In a previous blog post we talked about the Visio 2010 add-in for System Center Operations Manager 2007 R2 . For step by step instructions on how to set this up, check out this new article on TechNet:
Monitoring SharePoint Server by using Visio Services and System Center Operations Manager
There is tons of documentation available to help you with anything related to Visio Services. Here’s a roundup of it all:
Visio Services Setup, Configuration, and Planning:
Visio Services Development
Using External Data with Visio Services
Visio Insights Blog posts
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 2007 provides data connectivity support for a number of data sources such as Excel, SQL and SharePoint Lists. One interesting scenario is to pull in schedule information from a SharePoint calendar (a special list type in SharePoint) to generate a Visio timeline.
Visio MVP David Parker has posted an article that illustrates how to use Link Data to Shapes and the External Data window to bring in the SharePoint data and drop linked shapes onto a timeline. As David shows, the "secret" is to map the names of the date data fields to the names of the Shape Data properties used by Visio's timeline shapes. That way the timeline shapes don't just carry the SharePoint data around; they use the data to control their position on the timeline.
This mapping technique is useful for more than SharePoint lists and for more than timelines. Use it whenever you want to link data to existing Shape Data properties on a shape. You don't need to go rework the data source to match Visio's property names.
The Visio team would like to congratulate Visio MVP David Parker on his new book, Microsoft Visio 2010: Business Process Diagramming and Validation. This book provides an in-depth coverage of creating custom validation rules in Visio 2010.
After reading Microsoft Visio 2010: Business Process Diagramming and Validation, a few key things were apparent. First, this book covers a variety of topics. The book begins with an overview of process management in Visio 2010 and introduces Visio users to an assortment of new Visio 2010 features. Then two chapters are devoted to the Visio Object Model and the Visio ShapeSheet: powerful tools that combine to provide the unique development experience within Visio. Of course, there is a strong focus on the new validation feature but a reader will learn about a wide range of Visio topics.
Second, the book provides a large quantity of coded examples and even a chapter devoted to a worked example. These clear, well-thought-out examples are great for those who want to experiment in Visio as they read the book.
Finally, the book is a great reference for those interested in building custom validation rules. In Visio 2010, validation enables companies to ensure that their diagrams meet certain compliancy, business standards or more general requirements. Visio provides some built-in validation rules, but anyone can create custom validation rules to meet their own needs: you can specify your own custom diagram requirements, for any type of diagram, and Visio will verify these requirements for you. This book was written to teach people how to master this process of designing, implementing and sharing custom validation rules.
For more information about the book, check out David Parker’s book web site. We also have a chapter from the book, Understanding the ShapeSheet, available on MSDN.
This morning Microsoft announced that the Beta versions of Microsoft Office 2010, SharePoint Server 2010, Project 2010 and Microsoft Visio 2010 are now available! You can download Visio 2010 Beta here. This is a public Beta, so anyone can install and use it.
Visio 2010 Beta has numerous refinements based on customer feedback from the Technical Preview. The most visible changes can be found in the Backstage View. This area has been redesigned to feel more integrated with the rest of the Ribbon, as is explained in the Office 2010 Engineering blog. Also there are several visual updates. In the screenshot below, you can see the new look of the Backstage View found under the File tab.
Saving files to SharePoint is also different in Visio 2010 Beta. Now saving to a SharePoint location, saving to a Visio Process Repository and publishing to Visio Services have been combined into a single place. You simply choose a location and then select whether to save out a standard Visio Drawing or a Visio Web Drawing.
In the other ribbon tabs, you will find visual updates to Themes and a more functional set of Callouts. For improved ease of use, we’ve refined the behaviors of several diagramming features including adjusting the sensitivity of AutoConnect.
You will also find functional and visual updates to Containers, Cross-functional Flowchart shapes, BPMN shapes, Data Graphics Legends and Wireframe shapes. If you created diagrams with these shapes in the Technical Preview, please be aware that your existing diagrams will have the Technical Preview version of the shapes while new diagrams created in the Beta will have the new versions of these shapes. Also for Cross-functional Flowchart diagrams, significant shape and functionality changes mean that Technical Preview diagrams will open in the Beta but will not be editable.
More information about the features of Visio 2010 can be found on this blog. End user help is also available on the Microsoft Office Beta site.
Coinciding with the release of Visio 2010 Beta, we are releasing the Beta version of Visio Services as part of Microsoft SharePoint 2010 Beta. You can download SharePoint 2010 Beta from MSDN here. In addition we are releasing a Beta version of the Visio Software Development Kit, a download for solution developers. We will provide more information about the Visio SDK Beta in an upcoming post.
We encourage you to download the Beta and give us your feedback. We’re rapidly approaching the end of the Visio 2010 development cycle, and your feedback is essential to ensure a high quality final product. You can comment on the posts on the blog or use the Send a Smile tool to let us know what you think.
Recently Mark Nelson from the Visio team sat down with Harry Miller (off-screen) to discuss some of the improvements in Visio 2010 related to process diagrams. The video includes explanations of our Process Management investments as well as demos for Cross-functional Flowchart, BPMN diagram and Validation features.
The conversation is the latest in a video series titled “Visio: Drawing on Experience” posted on Microsoft TechNet. Other videos featuring some of our Visio MVPs can be found here: http://edge.technet.com/Tags/Visio/
In our previous post we introduced the Containers feature in Visio 2010 and demonstrated some of their basic capabilities. In this post we’ll look at some additional behaviors of containers.
Typically in Visio the most recently added shape is shown on top of the other shapes on the page. To change this display order you can use commands such as Send Backward or Bring Forward, which are found in the Arrange group on the Home tab. Containers are intended to sit behind other shapes in the drawing, so we added a new feature in Visio 2010 where we could designate a shape to automatically go behind other shapes when dropped. Thus you never have to move a container to the back, even if it was the last shape added.
In the previous post we mentioned that containers allow full access to the shapes inside because the container does not form a group. You can directly click on a shape in a container to select it. However, whenever shapes overlap, selection works differently; and it can be more challenging to select the exact shapes you want. We often observe users that select multiple shapes by dragging their cursor to create a selection rectangle. This is not possible when working on top of other shapes because the drag action will select the underlying shape and start moving it. Additionally, clicking a shape that is already selected will normally deselect it, but clicking a selected shape that overlaps another will deselect the shape and also select the shape underneath.
To make sure that containers do not interfere with the natural selection actions of users, we gave them a special ability. We made the interior of the container act like it had no fill for the purposes of selection. You can see this behavior in the Technical Preview by trying this: starting with no selection, place the cursor in one corner of the interior of the container and drag a selection rectangle around several shapes inside the container. You will find that the container is not selected and dragged as would normally occur with a filled shape.
We added one more touch to aid with shape selection in a container. There is a command in the Container Tools contextual tab and on the shape context menu to select all the container’s contents at once. You can access the Select Contents command when the container is selected or when a member of the container is selected.
Shapes placed into a container become members of the container. When the container is moved, copied or deleted the member shapes are also moved, copied or deleted. Since deleting a container deletes the members of the container too, what do you do if you only want to get rid of the container? You could drag all the shapes out first, but this is a lot of work to move them back afterwards. Thus we added a Disband Container command to the Container Tools contextual tab and shape context menu. This command deletes the container without deleting the contents.
So far we have always shown the member of a container inside the container boundary. It is also possible to put shapes directly on the container boundary. The shapes are still considered members of the container, but they behave differently during resize actions. To put a shape on the boundary of a container, simply drag it there. Notice the difference in highlighting feedback between dragging a shape into a container versus onto the boundary. Boundary highlighting appears along a single edge of the container.
Once a shape is on the container boundary it will move with that boundary. You can resize the container and the shape will stay on the boundary.
There’s even more that containers can do once you get into custom shape development. We’ll save that for a future post. Next we will look at a special application of the Containers feature. And don’t forget to send us your feedback through the Send a Smile feedback tool or by commenting on this post.
In an earlier post we talked about Visio being a general purpose diagramming and drawing application that enabled specialized behavior through its extensibility model. Custom shapes are combined with custom code to create an intelligent diagramming solution for a particular scenario. Sometimes users like to take this extensibility notion even further by creating their own shapes to work with the solution. We inevitably are asked how these new shapes can “join the club” or participate in the specialized behavior.
Unfortunately there is no single mechanism for registering a shape with a solution or converting a shape to work with a solution. Some Visio solutions provide this capability. Others do not, forcing the user to discover the secret handshake with the solution. We’ll look at a specific example in this post.
The Legend feature can be found in Visio’s Brainstorming template, or the Legend Shapes stencil can be opened from File > Shapes > Brainstorming. Special legend shapes are added to the diagram, and the Legend shape displays them with counts and labels.
Now imagine that you need a new shape to easily identify issues to be resolved. Here is a simple shape created with the Freeform tool. The initial alignment box for the shape is not ideal, but that can be fixed using Shape > Operations > Combine to fit the geometry into a nice upright rectangle.
It would be helpful to tally the issues in the diagram and have the total displayed in the legend as well. To do this, open the Document Stencil for the diagram by going to File > Shapes > Show Document Stencil. Then drag the issue shape over to the stencil. You should rename the shape from Master.11 (or similar) to Issue. You could also clean up the icon if desired.
Next we need to make the shape work with the legend. Drag the shape from the Document Stencil and drop it on the legend shape in the drawing. The following message will appear.
Choose Yes and then delete the shape sitting on top of the legend. Now drag out Issue shapes from the Document Stencil to annotate the drawing. The legend should reflect the total number of Issue shapes present.
We're going to kick off the Visio Insights blog with a series on the essential features that make Visio the popular diagramming application it is today. In each topic, we'll cover the basics from a user's perspective and then dive more deeply into the technical details.
Essential Feature: Drag and Drop
Fifteen years ago a new diagramming product hit the marketplace with a revolutionary way to draw. Rather than construct drawings from geometric primitives such as lines and arcs, Visio offered the ability to drag and drop pre-built shapes. One of the early tag-lines for Visio was Drag, Drop, Done. Making diagrams in Visio is more a matter of assembling than drawing, and this mechanism made diagramming approachable for many people.
So how does drag and drop really work?
The pre-built shapes are called Masters, often referred to as Master shapes. The masters are organized into documents called Stencils. The stencils are displayed on the left side of the drawing workspace inside the Shapes window. To add a shape to the drawing, you drag one of the masters from a stencil to the drawing page.
Behind the scenes Visio does a lot of work to place that shape on the page. A stencil is a separate document from the drawing, so Visio first must copy the master from the stencil to the drawing document. (This operation is generally not visible to the user. If you want to see the masters in the drawing document, go to File > Shapes > Show Document Stencil.) Then Visio creates an instance of the master shape and places it on the drawing page.
If you drag the same master shape out from the stencil again, Visio checks to see if there is already a copy of the master in the drawing document. If the master is already present, Visio skips the copy operation and proceeds to create another shape instance to place on the drawing page. Visio checks a property on the master called the UniqueID to determine if two masters are alike. Whenever you edit a master, the UniqueID changes. Thus it is possible for two masters to have the same name, but Visio will know that the masters are different by their UniqueIDs.
UniqueID lets Visio distinguish between two masters with the same name, but users may have more difficulty telling them apart. To avoid that problem, Visio forces the name of each master within a document to be unique. When you add a different master by the same name to a document, Visio automatically renames the incoming master by appending a decimal point and a number such as Person.1 . There may be a scenario where you want Visio to interpret masters with the same name as being identical, so there is a property on the master that you can set to “Match master by name on drop”.
Why go through all these steps to drop a shape on the page? It ensures that Visio documents are always portable. There are no external references to masters in a Visio document, so you can pass documents around and not worry about missing information. Master shapes are a powerful concept, and we'll have more to say about them in a future post.
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.
For anyone who wasn't able to attend the Visio Conference 2008 this February or has been itching to show everyone else the cool things coming in Visio "vNext", the wait is over! Videos from all the conference sessions are posted on http://www.visiotoolbox.com. Click on the conference link in the bottom-right corner of the page - or follow the links below.
Each session consists of the PowerPoint slide deck, speaker audio and video of the demos. Use the links below to jump to the sessions for each track:
Keynotes - http://www.visiotoolbox.com/visioconference2008/Keynotes/start.htm
General Sessions - http://www.visiotoolbox.com/visioconference2008/GeneralSessions/start.htm
Solutions Track - http://www.visiotoolbox.com/visioconference2008/BusinessSolutions/start.htm
Developer Track - http://www.visiotoolbox.com/visioconference2008/SolutionDevelopment/start.htm
End User Track - http://www.visiotoolbox.com/visioconference2008/EndUser/start.htm
For those specifically interested in Visio "vNext", here are the four sessions where we demonstrated some of the capabilities coming next release:
Visualizing Information Work Today & Tomorrow - Jeff Raikes keynote
The Visio Business Today and Software Development Process - Richard Wolf keynote
Visio Future Investments - Bill Morein
Visio Futures - API Insights - John Haug and Philippe Arida
You should be able to click on a link and then click on Play. The videos take a varying amount of time to load - a few minutes in some cases. If you find that the UI frame around the slides / video is missing, try refreshing the web page. This will reload the controls but the session will resume playing where you left off.
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:
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 "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.