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.
This is the second topic in a series discussing the essential features that make up the Visio application.
Essential Feature: Drawings, Stencils and Templates
In the previous post on Drag and Drop, we mentioned that Stencils were separate documents from the drawing and thus Visio has to make a local copy of a master shape when you drag one onto the page. So what is the difference between a stencil and a drawing? And what about templates?
Actually, there is very little difference between these three types of Visio documents. That's because there is really only one document type in Visio. Drawings, stencils and templates are the same technically. The difference is in the “view” of the document information presented to the user.
Try this: make a simple flowchart by starting from the Basic Flowchart template. Drag some shapes onto the drawing page from the Basic Flowchart Shapes stencil. Save the drawing as MyDrawing.vsd and exit Visio. Now rename the file, changing the extension from 'VSD' to 'VSS'. Reopen the drawing in Visio. What do you see? You should see a stencil with just the master shapes you dragged into your drawing. Close Visio and change the extension to 'VST'. Now what do you see when the file is reopened? You should see your drawing but with a generic filename like Drawing1.
What's going on? Every Visio document has a drawing surface - the page that you drop shapes on. Every document also has a stencil containing masters, called the Document Stencil. The file extension tells Visio whether to open a document showing the drawing surface or the stencil. You can see the Document Stencil for your drawing by choosing File > Shapes > Show Document Stencil. Templates are just like drawings. The only difference is that Visio will open a template as a copy of the original document by default. This explains the change in filename.
Another part of a Visio document is the workspace information. Whenever you save a drawing, Visio records the names of the stencils that were opened with your drawing. These stencil documents are automatically reopened the next time your file is reopened.
Those of you who are familiar with Visio's file format history know that there are now two sets of Visio file extensions. VSD, VSS and VST are the drawing, stencil and template extensions for Visio's binary document format. There is a companion set of VDX, VSX and VTX extensions for Visio's XML document format. The XML document format is a full fidelity peer of the binary format that was introduced in Visio 2002. The XML formats offer an under the hood view of the contents of a Visio document. They allow developers to write programs that build new drawings from scratch or read the contents of a drawing – all without having to launch the Visio application.
Try saving out a drawing as XML and then opening the file in a text editor. You can rename the file to give it a .XML extension and view it in Internet Explorer too. There is a lot of information, but if you dig around you'll find the Masters collection that makes up the Document Stencil and the Pages collection that makes up the drawing. You may even find the workspace information.
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.
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.
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.
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
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.
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.
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.
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."
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.
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.
Visio has several features that are designed to make it easy to create a diagram quickly. Here are three examples of ways to help you create a simple flowchart in under a minute.
Let’s assume you have a pretty clear idea of what the steps are that you want to diagram and the order that you want them in, so all you need to do is capture the flow quickly. Once you drop your first shape you can use the AutoConnect feature to fill in the rest of the diagram quickly (for more details on AutoConnect, see the blog post here.). When you hover over the selected shape, four arrows will appear. Hovering over the triangle that points where you want the shape to appear will display a mini-toolbar to let you pick any of the first four Quick Shapes from your current stencil. One click on the shape you want will add the shape, a connector and uniform space between the shapes.
The ability to add connected shapes with a single mouse click works really well when your goal is to get shapes onto the page quickly and then add text and formatting. Once you’ve got the shapes in place, you can double-click on shapes and connectors to add the labels and, as a final step, click on the Design tab and pick a theme to make it look really professional. In just over twenty mouse clicks and some typing, you’ve got a finished flowchart in well under a minute.
But suppose you know what steps you want to diagram, but you still need to figure out how to lay them out and how they all fit together. How can you make that process quicker? You can start by adding a shape for each step you know you need and labeling it as you go – don’t worry about where you place them for now, just concentrate on getting all of the items on the page. Once you think you have shapes for all of the major steps you need on the page, you can start dragging them around and organizing them into the real flow. Don’t worry about connectors for now, just get the shapes where you want them. Alignment guides make it easy to ensure that spacing is even; as you drag shapes near each other the guides will appear to help you out.
Once you’ve got shapes where you want them, those little AutoConnect triangles can help you out again. Hover over the triangle which points to the next shape just a little longer than it takes for the shapes toolbar to appear and a connector will appear. Click and it will draw connectors for your shapes automatically.
Since you’re building your diagram as you go, it’s easy to forget a step. Don’t worry, that’s not a problem. If you’ve already connected shapes and realize that a step belongs between them, just drag the new shape over the connector between the two shapes where you want the new one. You’ll see the cursor connection points highlight, and when you drop the new shape it will be inserted between the two shapes and connected up. By the way, if you delete a connected shape, Visio will automatically reconnect the remaining shapes, too. Note that the connectors are using dynamic glue by default. You can learn more about dynamic glue here.
Just like the first example, you can add some theming to make your diagram look great and you’re done.
As a final example, suppose you want to make a flowchart for a presentation and you want to use combine flowchart shapes with some non-flowchart shapes to make it look fancier. Because you want to use a variety of shapes, you want to be able to grab shapes from a number of different stencils to build up a good looking diagram. The AutoConnect triangles can help you do this quickly, too. This time, instead of hovering over the triangle and selecting a shape from the dialog that pops up, you can drag any shape from a stencil in the shapes pane, move it over the shape you want it to connect to and, when the triangle highlights, drop it to add a connected shape.
This allows you to quickly create a diagram that uses many different shapes from multiple stencils.
If you take some time to experiment with AutoConnect and its various features, you’ll find that just a minute is long enough to generate a simple flowchart that looks good and communicates well. Even better, you’ll find ways to shave some valuable time off of those bigger projects, as well.
As always, we value your feedback. Please let us know if you have any feedback on Visio 2010, Visio Services, or suggestions for blog posts you would like to see.
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.
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:
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.
The video below shows how to add a Data Graphic legend to a drawing using C# code. How might you use this code within the context of constructing diagrams with Data Graphics?
As mentioned in a previous blog post, Visio Professional 2010 and Visio Premium 2010 use container shapes to create legends for data graphics. Along with this new feature, the Visio 2010 Object Model includes new APIs that allow you to manipulate container shapes programmatically – including the Page.DropLegend method that allows you to add a Data Graphics legend to your drawing using code.
We’ve created this how-to video about using C# to add a Data Graphics legend to a drawing page. While creating this video, we considered some of the larger scenarios where this API might be used. We’d like some feedback from you, the Visio developers and users, to learn more about how you use these features:
· How often do you create Visio drawings that are linked to data? Do you link that data to shapes? Do you use Data Graphics to visualize the data contained in the shapes?
· Which templates do you use most frequently to represent external data?
· When you link a drawing to external data, which data providers do you most commonly connect to (e.g. Excel, Access, SharePoint lists, SQL Server, etc.)?
· What other tasks do you frequently perform in addition to linking a drawing to external data?
· How often do you use code to manipulate external data in Visio, using VBA, C#, or VB.NET? Have you ever applied data graphics to a Visio diagram using code?
Please watch the video and submit your feedback using the comment box below this post.
Note: The Data Graphics legend feature is only available in Visio Professional 2010 and Visio Premium 2010.
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.
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.
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 this post, we’ll be covering improvements to the ShapeSheet in Visio 2010 that make it easier for shape developers to create and modify existing Visio shapes.
For those who don’t know, Visio shapes are more complex than they may seem at first; behind each shape is a ShapeSheet (you can get more details here and here if you're unfamiliar with the ShapeSheet). In Visio 2010, you can access a shape's ShapeSheet by selecting the shape in question and clicking the "Show ShapeSheet" button on the Developer tab. If you don’t have the Developer tab up already, learn how to turn it here. Once you’re in ShapeSheet mode you’ll see the following user interface:
As you navigate through the updated ShapeSheet experience you’ll quickly stumble on our improvements. In the ShapeSheet editing window (1 above), Visio 2010 now facilitates user input with a new feature called ShapeSheet Formula AutoComplete. The ShapeSheet user interface has also been simplified considerably by the creation of the ShapeSheet Contextual Tab (2 above) to facilitate common ShapeSheet actions.
Let’s take a deeper look into each improvement.
One key features of the ShapeSheet is that it enables Visio shape developers to create a dependency between one shape property (also known as a ShapeSheet cell) and another through a formula. For example a shape developer can set height = 2 * width.
To this day, to become a proficient shape designer, you had to memorize all 345 cell names, 17 row names, 40 section names and the syntax to 181 ShapeSheet functions – not an easy task! Visio 2010 however makes your life much easier by introducing a new feature called ShapeSheet Formula AutoComplete. This feature helps you compose ShapeSheet formulas by:
1. Providing a context-sensitive list of ShapeSheet formula keywords as you type. All ShapeSheet functions, section names, row names and most** cell names are accessible via ShapeSheet Formula AutoComplete (**Visio doesn’t surface cells in non-named rows such as the “X1” or “Y1” rows in the Geometry section). As you compose a formula in a cell, Visio scrolls a list of keywords that are appropriate for the current context and selects the keyword that most closely matches what you're typing.
Take a look below to see ShapeSheet Formula AutoComplete in action. As you type “P-R-O”, the list of keywords scrolls to the “Prop” section name which also gets selected as Visio’s best guess. After auto-completing the section name by using “.”, Visio replaces the keyword list with one that makes sense in this new context, in this case the shape data item “CostOfShape”.
Also notice that Visio helps you locate the keyword you’re looking for by sorting them alphabetically and tagging them with one of the icons below depending on what type of keyword it is.
2. Providing a quick input mechanism for ShapeSheet formula elements. Once you've typed enough letters to uniquely identify a ShapeSheet keyword, you can simply hit "Enter" or "Tab" to complete the keyword. Depending on context, the ",", ".", "!", “*”, “+”, “-”, “/”, “[”, “(“ and “)” symbols will also do the trick.
3. Providing a definition of the ShapeSheet items. If you're not sure of the definition of a ShapeSheet keyword, a tool tip appears next to the currently selected keyword in the AutoComplete list with a definition for it. For example, below, is a definition for the PATHSEGMENT function, one of the new ShapeSheet functions in Visio 2010.
4. ShapeSheet function parameter browsing. As you compose a ShapeSheet function, the function signature appears above the cell in a tooltip. The bolding in the tooltip changes as you progress through a function’s arguments.
5. ShapeSheet formula parenthesis matching. As you close a parenthesis pair with a ")" character, ShapeSheet Formula AutoComplete will highlight the matching open-parenthesis in red.
ShapeSheet Formula AutoComplete is available in the following textboxes, dialogs and windows throughout Visio 2010:
The ShapeShee Formula AutoComplete feature can be toggled off through one of these entry points:
Apart from ShapeSheet Formula AutoComplete, the ShapeSheet has gotten a facelift thanks to the Fluent UI – all ShapeSheet related commands are now in one place. Take a look at the ShapeSheet contextual tab below.
In more detail:
Toggle the “formula” view of the ShapeSheet – all cell formulas are shown.
Toggle the “value” view of the ShapeSheet – all cell results are shown.
Surfaces the “View Sections” dialog which lets you show or hide ShapeSheet sections.
Surfaces the “Style Explorer” pane that lets you view and edit styles in the current drawing.
Adds optional sections of your choice to the currently selected ShapeSheet.
Deletes the optional section you have currently selected.
Adds a row to the optional section you have currently selected.
Deletes a row from the optional section you have currently selected.
Surfaces the “Edit Formula Dialog”, seen below, which gives you more room to enter long equations as well as the possibility of adding carriage returns to your formulas to improve legibility. As you can see below, ShapeSheet Formula AutoComplete is still active in this dialog.
Note that you can also open this dialog by using the “ctrl+e” key combination.
Adds a ShapeData row to the currently selected ShapeSheet.
Adds a Hyperlink row to the currently selected ShapeSheet.
Adds an Action Row to the currently selected “Actions” section.
Toggles the visibility of the “Formula Tracing” window.
List in the “formula tracing” window all the cells the currently selected cell depends on.
List in the “formula tracing” window all the cells that depend on the the currently selected cell.
Jumps to the previous cell in the formula tracing history.
Jumps to the next cell in the formula tracing history.
Using the Fluent UI, Visio can now enable and disable interactively the ShapeSheet operations that you can take against a particular cell while you're editing it; this removes some of the right-click menu hunting you may have done in the past.
The final change we’ve made to the ShapeSheet experience in Visio 2010, is to enable shape designers to open one ShapeSheet window per shape instead of re-using the same window for all shapes, the latter behavior being the default in previous releases of Visio.
Download Visio 2010 Beta and start building shapes with the 2010 ShapeSheet -- we're interested in hearing what you think of Visio's new and improved ShapeSheet experience. You can send us your feedback by either commenting on this blog post or sending us information via Send a Smile.
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.
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.
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.
When we talk to developers to get their feedback on the Visio development platform, a common request we hear is the ability, through the API, to control the settings used when exporting a diagram as a raster image in the PNG, JPG, BMP, or TIFF format. Typically, they want to automate the export of the pages in a document as images for use in a web page or other application that requires certain settings. In this post, we’ll talk about the additions to the Visio 2010 object model that let developers configure each of these raster export settings.
When you save a diagram in one of the raster formats, a dialog box appears to let you configure various settings, such as the color format, resolution, or size of the image. For example, this is the dialog for the PNG format:
Until now, there hasn’t been a way to automate the settings in this dialog via the API. In Visio 2010, we’ve enhanced the object model to make it possible to drive these settings programmatically using a set of new methods and properties on the ApplicationSettings object. You can use the methods to get and set the raster-export resolution and size, and you can use the properties to get and set raster export attributes such as data format, data compression, color reduction, color format, background color, transparency, and quality. You can use these methods and properties with the existing Page.Export and Selection.Export methods to export a diagram in a raster file format.
Here is the complete list of new raster export methods and properties on ApplicationSettings:
Returns the raster export resolution settings.
Gets the raster export size.
Specifies the raster export resolution settings.
Sets the raster export size.
Determines the background color that is applied to the exported image.
Determines the color format that is applied to the exported image.
Determines the color reduction that is applied to the exported image.
Determines the data compression algorithm that is applied to the exported image (BMP, TIFF).
Determines whether the exported image is interlaced or non-interlaced (PNG, GIF).
Determines the flip that is applied to the exported image.
Determines the export operation that is applied to the exported image (JPG only).
Determines the export quality that is applied to the exported image (JPG only).
Determines the rotation that is applied to the exported image.
Determines the transparency color that is applied to the exported image (PNG, GIF).
Determines whether Visio applies, to the exported image, the transparency color that is specified in the RasterExportTransparencyColor property (PNG, GIF).
For more details on these methods and properties, such as their parameters and constants, see the Visio Developer Reference in the Visio 2010 Beta.
This VBA code executes the settings in the PNG Output Options dialog box as shown above and exports the diagram as a PNG:
'Set the export resolution to the printer resolution at 600 x 600 pixels/inch Application.Settings.SetRasterExportResolution visRasterUsePrinterResolution, 600#, 600#, visRasterPixelsPerInch 'Set the export size to custom 8 x 5 inches Application.Settings.SetRasterExportSize visRasterFitToCustomSize, 8#, 5#, visRasterInch 'Set the data format to Interlace Application.Settings.RasterExportDataFormat = visRasterInterlace 'Set the color format to 24-bit color Application.Settings.RasterExportColorFormat = visRaster24Bit 'Rotate the image to the left Application.Settings.RasterExportRotation = visRasterRotateLeft 'Don’t flip the image Application.Settings.RasterExportFlip = visRasterNoFlip 'Set the background color Application.Settings.RasterExportBackgroundColor = 14798527 'Set the transparency color Application.Settings.RasterExportTransparencyColor = 13269045 'Use the transparency color Application.Settings.RasterExportUseTransparencyColor = True 'Export the active page as a PNG to the specified path Application.ActiveWindow.Page.Export "<drive>:\<path>\Network Diagram.png"
'Set the export resolution to the printer resolution at 600 x 600 pixels/inch Application.Settings.SetRasterExportResolution visRasterUsePrinterResolution, 600#, 600#, visRasterPixelsPerInch
'Set the export size to custom 8 x 5 inches Application.Settings.SetRasterExportSize visRasterFitToCustomSize, 8#, 5#, visRasterInch
'Set the data format to Interlace Application.Settings.RasterExportDataFormat = visRasterInterlace
'Set the color format to 24-bit color Application.Settings.RasterExportColorFormat = visRaster24Bit
'Rotate the image to the left Application.Settings.RasterExportRotation = visRasterRotateLeft
'Don’t flip the image Application.Settings.RasterExportFlip = visRasterNoFlip
'Set the background color Application.Settings.RasterExportBackgroundColor = 14798527
'Set the transparency color Application.Settings.RasterExportTransparencyColor = 13269045
'Use the transparency color Application.Settings.RasterExportUseTransparencyColor = True
'Export the active page as a PNG to the specified path Application.ActiveWindow.Page.Export "<drive>:\<path>\Network Diagram.png"
We hope these additions to the API for raster export open up some new possibilities for Visio developers, or at least make it easier and more efficient to build automated solutions. Let us know what you think by commenting on the blog or using Send a Smile.