A reader asked how to fill a shape with a custom fill pattern from a fixed list in of a shape. They had no trouble with the first 25 standard fill patterns, but couldn’t figure out how to apply a custom pattern. So, I shall try to explain how this can be done …
This is an ordered list of the first 25 fill patterns have a tooltip (in English) that can be applied with the Format Shape panel:
- Transparent
- Solid
- Dark upward diagonal
- Large grid
- Large outlined diamond
- Dark downward diagonal
- Dark horizontal
- Dark vertical
- Light 20%
- Light 30%
- Dark 30%
- Dark 20%
- Dark 10%
- Dark wide horizontal
- Dark wide vertical
- Light downward diagonal
- Light upward diagonal
- Checkerboard
- Trellis
- Dark narrow horizontal
- Dark narrow vertical
- Dark narrow downward diagonal
- Dark narrow upward diagonal
- Small grid
- Small outlined diamond
I created a couple of custom fill patterns, Custom Circles and Custom Diamonds to the document, and added their names to a semi-colon list containing the standard fill patterns. This was entered into the format cell of a fixed-list Shape Data row called Fill.
="Transparent;Solid;Dark upward diagonal;Large grid;Large outlined diamond;Dark downward diagonal;Dark horizontal;Dark vertical;Light 20%;Light 30%;Dark 30%;Dark 20%;Dark 10%;Dark wide horizontal;Dark wide vertical;Light downward diagonal;Light upward diagonal;Checkerboard;Trellis;Dark narrow horizontal;Dark narrow vertical;Dark narrow downward diagonal;Dark narrow upward diagonal;Small grid;Small outlined diamond;Custom Circles;Custom Diamonds"
Then I created a User.FillIdx row with the formula:
=LOOKUP(Prop.Fill,Prop.Fill.Format)
This will get the index number of the selected fill pattern from the list. This index number is all that is required for the value in the FillPattern cell for the standard fill patterns, but the custom patterns need to be specified by name with the USE(…) function. So, the following formula will use the numeric index value for the standard fill patterns, but the name of the custom fill patterns:
=GUARD(IF(User.FillIdx<25,User.FillIdx,USE(Prop.Fill)))
This is how the relationship is setup in the ShapeSheet between the FillPattern, Prop.FIll and User.Fill rows:
This video shows the above in action:
When is a Visio Callout not a Callout?
I have been a Visio user/developer since the mid-1990’s and seen the word “callout” used as part of the name of many master shapes in Visio. The images below show five ways that the term “callout” has been applied to the name of Visio master shapes. Generally, each evolution has been an advance on the…
Using Visio Color by Value on Connectors
Data Graphics in Visio Plan 2 and Visio Professional is great, but it only enables us to use them with 2D shapes in Visio, i.e. not on connectors. So, what if you want to change the line colour of the connectors between the 2D shapes because of the data flowing between them? Well, it is…
Using Notepad++ to Edit Visio ShapeSheet formulas
Visio shapes get their smartness from the formulas that are entered into the ShapeSheet, but editing these formulas can be extremely tricky and prone to error because of the lack of a modern programmer’s interface. Formulas can be quite long (up to 64k characters) but even medium size ones like the one in User.GetWorkdays cell…
Adding a second Function header bar to Visio swimlanes
I was recently asked if a second function header bar can be added to the swimlanes in the cross-functional flowchart templates in Visio. Some swimlanes can get quite wide, so it can be useful to have a duplicate function header shape on the far-side too. It is quite simple to duplicate the existing function header…
More Parsing XML Data in Visio Shapes
My last article looked at parsing an XML string with a known structure and order of elements and attributes. This can be acceptable in some scenarios, but what if the elements or attributes are in a different order? Then it is necessary to use the element and attribute names rather than their index position. This…
Parsing XML data in Visio Shapes
One of my current projects uses XML data, and some of the values in the XML data control the display and content of Visio shapes. Therefore, I looked deeper into how the XML data can be used directly to control parts of the graphics. Although the external data linking feature in Visio Professional and Visio…
Leave a Reply