How to force visio to re-evalute formulas when an untrusted visio document is op

Started by ehudon, September 21, 2009, 06:01:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ehudon

Hello Everyone,

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

JuneTheSecond

Hi,

I think
<Width F="No Formula">0.75</Width>
<Height F="No Formula">0.5</Height>

should be written as
<Width F="0.75">0</Width>
<Height F="0.5">0</Height>

or

<Width>0.75</Width>
<Height>0.5</Height>
Best Regards,

Junichi Yoda
http://june.minibird.jp/

ehudon

Thanks for the quick reply. I have tried both approaches. And it still does not work.

That piece of code gave me an idea.

<Width F="0.75">0</Width>
<Height F="0.5">0</Height>


I have tried using SETAREF and others to and still the same result. My
group shape has the proper width and height, but the formula in the sub-shapes are not re-evaluated.

vojo

if you are going to this much trouble...could look at the following:

Define a cell at the page level shapesheet (page!user.mytrigger)....upon open, change the value of this cell (X = X+1). 
This could be done via VBA at open or whatever.

Set all shapes to be updated to have the " + dependson(page!user.mytrigger)" in their formulas.

This will trigger the cells to be reevaluated because the dependency cell has changed.

Note, that cell evaluation is not deterministic (cant count on same order every time).   So if some sort of
sequence dependency, might need another " + dependson()" to make sure cell evaluated/reevalutated as
appropriate.

ehudon

Thank you very very much. It looks like it solves my problem. You made my day! :)