I am working on an application where the horizontal axis of the Visio page represents dates from left to right. In fact, the each of the fixed horizontal grids are 1 day, and I need to have shapes that understand the begin date at the left edge of the shape, and the end date at the right edge of the shape. There is, therefore, a number of elapsed days representing by the width of the shape. However, the underlying grid can either represent all days, or it can be changed to only represent weekdays by omitting the weekends. I struggled to find the best formula to calculate the elapsed days or weekdays between two dates in Visio ShapeSheet formulas, so I turned to Excel to provide an inspiration. The Visio ShapeSheet is modelled on the Excel worksheet, and formulas can be entered into the cells in much the same way. However, the available functions differ since Excel is mainly used for arithmetic and statistics, but Visio is used for graphics and data. In this article, I demonstrate how I used C# and Excel to construct and test formulas for use in a Visio shape.
[Read more…] about Prototyping Visio ShapeSheet Formulas in ExcelbVisual Blog by David Parker
Controlling Visio layers with linked data
Readers of my blog will know that I use the layers in Visio pages to change the display for different scenarios. My macro to toggle layers on/off has been very popular, and I have written an add-in to manage layers that is widely used. However, I was recently asked if the layer settings can be controlled from linked data. Linking data in Visio has been available in all desktop editions, except Standard, since 2007, and I have written many articles and two books extolling this feature, but I haven’t so far controlled layer settings with it, so this article describes how this can be done … as shown in the following screen recording!
[Read more…] about Controlling Visio layers with linked dataReading the registry for Visio settings
I love writing Visio automation code, but I really don’t like writing setup & deployment scripts. There are so many variables : What Visio version, which edition? Which bitness (x86 or x64)? What are the user settings for the paths of stencils or templates?
So, I decided to write myself some C# functions that can be used in custom actions for an installation writing application, such as Advanced Installer. I think of the methods as being in one of three phases, Installation; Functionality and Configuration. The registry has three different areas to search within, Classes Root (HKCR); Local Machine (HKLM) and Current User (HKCU). In addition, the best way to get the true file version of Visio is to use FileInfo on the executable. The following screenshots are from a Cross-Functional Flowchart of the functions that get values for variables, and use them in other functions, until, eventually, the current user settings can be read.
Each of the functions I wrote handle the part of the registry that needs to be used. By that I mean that some settings for 64bit Visio on 64bit Windows will be in a different branch than 32bit Visio on 64bit Windows.
The first function gets the current version of the application associated with Visio drawings:
Fixing the Layers problem with Callouts in Visio
I recently re-discovered an issue with callouts in Visio for a couple of projects that I am working on, and so I had to find a fix. The problem is that the callouts become dis-associated from their target shapes if either the layer visibility of the callout or the target shape is toggled off, and then back on again. This will result in a diagram with shapes without any connected callouts, so moving any of the target shapes will not move their associated callouts with them! I initially came up with a workaround that involved some jiggery-pokery with sub-shapes and layers, but it seems that the problem could have easily been averted if Microsoft had incorporated one specific User-defined Cell from the very start…
First, I should be clear which callouts I am talking about because the word has been used and abused over the years … This article refers to the callouts that are inserted from the Insert / Diagram Parts ribbon group. These are part of the Structured Diagrams concept that was introduced with Visio 2010.
Support for the Visio JavaScript API in SharePoint Modern Framework, and more
It was the last day of the MSIgnite conference today, and the video of the final presentation about Visio was worth staying for, even though some of it was content I knew about, and have mentioned in previous posts this week ( see Dive into the world of data-driven operation intelligence with Microsoft Visio, Excel and Power BI). However, there was some content I was particularly pleased to see, and that was about support for the Visio Online JavaScript API support in Modern SharePoint Framework. I have pulled out some of the key slides below, but check out the full session for more information.
The hardworking Microsoft Visio product development team have worked hard to almost match all of the functionality of the old server-side Visio services control, but they haven’t quite got everything. So I cheered when I hear that support for html overlays are in the roadmap to be supported! All I ask for now (almost) is layer control, and I will be very happy.
They also stated that they will be enabling all this functionality for non-SharePoint web sites in the future!
Go to http://aka.ms/voapireference got more details.
Really Snapping to Grids in Visio
Visio has the ability to refine the options for snapping shapes to just grids, but this does not necessarily mean that shapes will automatically position themselves on a grid, or that the size is a multiple of a grid. What if you want some shapes to always be positioned on a fixed grid, and the width and height to always be a multiple on the horizontal and vertical grids respectively? What if you want the grid to start at the top left rather then the default bottom left? Fortunately, the ShapeSheet of the page and shapes can provide this ability, without the need for any external code.
You can set the page to have Fixed horizontal and vertical grids, each with different minimum spacing, if necessary. You can set the grid and ruler origins using the Ruler & Grid dialog, but it will be always relative to the bottom left corner of the page. So this can be a problem if you change the print margins or the page size, if you really want the grid origin to remain in another position, like top left.
You can just leave the Grid for snapping, and even change its strength to Strong, and even enter a larger number manually. This can help with snapping to the grids, but it is not enforced to be exclusive to the grids.