Strange: FormulaU returns value instead of formula

M

Markus Breugst

Dear All,

I have a 2D shape with four connection points, and I named them TOP, BOTTOM,
LEFT and RIGHT.

If I connect the start point of a 1D connector shape to my 2D shape, I have
two possibilities:

1.) I connect the 1D shape to the entire 2D shape (i. e. i build a "dynamic
connection"). In this case, the BeginX cell of the 1D shape contains the
following formula:
_WALKGLUE(BegTrigger,EndTrigger,WalkPreference)

2.) I connect the 1D shape to one of the four connection points of the 2D
shape. For example, if I use the BOTTOM point, the BeginX cell of the 1D
shape contains the following formula:
PAR(PNT(Sheet.55!Connections.BOTTOM.X,Sheet.55!Connections.BOTTOM.Y))

Now, I want my C# application to determine how the 1D shape is connected to
the 2D shape. I try to do this by examining the BeginX formula. (If the
formula contains the string "BOTTOM", I know that the connector is connected
to the BOTTOM connection point.)

Here's the line of code that retrieves the BeginX formula:
string beginXFormula = oneDShape.get_Cells("BeginX").FormulaU

If the 1D shape is dynamically connected, the variable 'beginXFormula'
contains the value I would expect:
beginXFormula = "_WALKGLUE(BegTrigger,EndTrigger,WalkPreference)"

BUT:
If the 1D shape is connected to one of the four connection points of the 2D
shape, the variable 'beginXFormula' does NOT contain the formula, but the
VAULE of the coordinate (as string):
beginXFormula = "86.5200 mm"

Instead, I would like to get the formula
"PAR(PNT(Sheet.55!Connections.BOTTOM.X,Sheet.55!Connections.BOTTOM.Y))"
instead.

Does anybody have an idea what's wrong here?

Thanks and best regards,
Markus
 
M

Markus Breugst

Addendum: I tried the same with a VBA macro, and it works: I always get the
formula instead of the value, as I would expect.

(By the way: The strange behavior occurs in a C# application that uses the
Visio ActiveX control.)
 
C

Chris Roth [MVP]

Hi Markus,

It works for me in U.S. English Visio 2003, but I didn't test a german
version.

Perhaps .get_CellsU("BeginX") is worth testing? Also, make sure you've glued
the Begin and not the End. The Begin has an "x" in the green dot. ; )

--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio
 
M

Markus Breugst

Chris,

thanks for the hint. Unfortunately, it does not solve the problem: get_Cells
and get_CellsU return the same results:
- Formula = "68,316666 mm" (i. e. the German notation with a comma as
separator)
- FormulaU = "68.316666 mm" (i. e. the English notation with a dot as
separator)

But nowhere I can see the actual formula
"PAR(PNT(Sheet.55!Connections.BOTTOM.X,Sheet.55!Connections.BOTTOM.Y))".

Really strange. I'll see if I can find an English version of Visio somewhere
in our company. However, most of our customers have German versions, so I'll
have to find a solution that works with this one.

Best regards,
Markus
 
M

Markus Breugst

Got it working. There were some side effects of our application that
disconnected the 1D shape in some special cases.

Thanks again for testing it, Chris!

Best regards,
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top