3
votes

I have a module that creates a Visio file (VDX) outside Visio. According to the SDK this refers to 'untrusted' XML. I've created my xml file by copied the Masters from my stencil and then refer to them using an XML sparse file.

In my sparse xml I override the shape's location and size this way:

<Shape ID="154" Master="0">
       <Text>Text of the shape</Text>
       <XForm>
         <PinX>2.90625</PinX>
         <PinY>3.895833333333333</PinY>
         <Width F="No Formula">0.75</Width>
         <Height F="No Formula">0.5</Height>
       </XForm>
</Shape>

My shape is a group that has sub-shapes.

It works, Visio is able to open it, but the sub-shapes has the default width and height of the master. Also the links between by shapes don't route properly.

If I copy/paste in the same of new file, then I get the expected result.

I have tried to force the width and height of sub-shapes. I get the same problem.

I have tried using VBA code on opening of the document by explicitly calling the trigger() method of the Cell class and I get the expected results. It also work, I open the shape sheet. The value is there in black, I just hit enter on the cell, and I get the expected result as well.

My understanding of the problem, is that visio does not evaluate the formulas of my sub-shapes when I open the document.

Unfortunately, I cannot rely on macros to force and update the cells. I would like to know if there's a way to force the formulas of my sub-shapes to be re-evaluated when I open my document.

Thanks in advance.

Eric

2

2 Answers

0
votes

Based on http://blogs.office.com/2013/01/29/10-tips-for-developers-working-with-the-visio-vsdx-file-format/

use the RecalcDocument flag in the docPropscustom.xml part. This will cause a complete recalculation, similar to the load behavior from VDX, but will also significantly slow down load. Once the file has been recalculated and loaded, the next save will remove the RecalcDocument flag from the document. This will limit the performance hit to a single file load. An example of the custom.xml part with RecalcDocument flag is shown below.