It seems that when a shape is set to use formula for its width, the method Shape.getXForm().getWidth() returns wrong value. In our project we use the formula (TEXTWIDTH(TheText)) to set auto fit the text inside a shape but when we check the width, it always returns the master’s width instead of this shape’s width.
I have attached a sample project that generates a diagram with a single shape using this formula as text.
ShapeWidth.zip (71.6 KB)
When checking the shape’s width in visio, the real value is show 1.57 instead of 1.44 being returned by Shape.getXForm().getWidth()
actualWidth.PNG (24.1 KB)
I think this is similar to How to programmatically resize shape as per text? - #7 by imran.rafique