Different behaviour of Addin in Visio 2013 in comparison to other Visio versions

Started by THartl, February 13, 2013, 10:26:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THartl

Hello,

first of all, please excuse my bad english.

We have developed our addin for MS Visio since many prior Visio versions now. Now, with Visio 2013 we encounter serious problems, i will try to describe here.

We have 3 shapes with user defined properties. With the code in our solution we are able to combine these shapes together without loosing the user defined properties. The result may look like this:



Unfortunately under Visio 2013 we get one of the following results:



I will describe what we do in CodeBehind to achieve our goal:

All 3 shapes are selected and then via context menu there is a QueueMerkerEvent fired to which our code is reacting with the following logic:

- first shape of selection gets duplicated via shape.Duplicate() and we get the resulting shape we call now vShapeNew

- now for the Initial selection we make a Selection.Union() which results in another shape we call now vShapeUnion

- in shape  vShapeNew we delete all sections in GeometrySection with
vShapeNew.DeleteSection(CShort(Visio.VisSectionIndices.visSectionFirstComponent))

- now we iterate through all GeometrySections in vShapeUnion and do the following for  vShapeNew

• we create the same section with vShapeNew.AddSection(CShort(iSectionGeometry))

• for each row in this section of vShapeUnion we create the same rows in  vShapeNew with
vShapeNew.AddRow(CShort(iSectionGeometry), CShort(iRow), 0)
iType = vShapeUnion.RowType(CShort(iSectionGeometry), CShort(iRow))
vShapeNew.RowType(CShort(iSectionGeometry), CShort(iRow)) = CShort(iType)


• for each cell in this row we copy the values of vShapeUnion into  vShapeNew with

vShapeNew.CellsSRC(CShort(iSectionGeometry), CShort(iRow), CShort(iCell)).FormulaU = vShapeUnion.CellsSRC(CShort(iSectionGeometry), CShort(iRow), CShort(iCell)).FormulaU


- at the end of our code we delete the vShapeUnion with Shape.Delete()


Resulting is an union shape with same user defined properties as before.

What i found out was that its always one point inside the Geometry which seems to have one value wrong in one cell (either the X or Y coordinate). Which point this is depends from the order in which the shapes gets selected initially. In new Visio 2013 ShapeSheet works with relative positions (RelMoveTo & RelLineTo), but this does not to be the problem.

Which definitely is a problem, that sometimes (not always, i did not find out when it happens and when not) Visio 2013 does not delete the geometry section where it does delete under Visio 2010. The SDK for Visio 2010 (i dont have one for Visio 2013 yet) says, that deleting of section fails, when there is not section with this ID. But why has the same file with the same shapes, and when i duplicate a shape under Visio 2010 and Visio 2013, that the resulting shape has different geometry IDs?

Right now, i am quite stucked, and we can not provide our addin for Visio 2013.

Does anyone have any idea, what we can do here, without waiting for Visio 2013 SDK and then make code changes and compile a different Version for Visio 2013, which i wanted to avoid if possible.

I know the code above is quite suboptimal, it was created years ago.

I am asking why the code works fine for Visio 2002, 2007 and 2010 but does produce different results under Visio 2013.

If wanted, i can provide a small test solution (VSTO addin under VB.Net) for exact this Problem.
Just for your Information, i posted the same questions some minutes ago in MS Forum. There are not many VIsio Gurus out there, i just wanted to be sure, that i can reach as many as possible of them  :)

Yacine

Hi,
I did not understand what you mean by custom properties.
If you mean the formats of the shapes, then you obviously want to keep the formats of one specific shape rather than others. To perform thie operation, just use the regular join operation that comes in standard with visio.
The first shape selected defines the format of the resulting joined new shape.
You may want to guide your users by means of dialog asking them to first select that one shape, then the other ones ,... etc.

If on the other hand you want to keep the user-defined cells and the shape data sections you may either write your own routine for copying these sections (easier than the geometry sections) or use a tool like this : http://www.sandrila.co.uk/visio-utilities/ (I am paying my debt against Paul ;-) ).

I guess that is not the answer you expected, but both solutions described above seem (to me) more obvious than your's.

Regards,
Yacine.
Yacine

Paul Herber

Bear in mind that Visio 2013 is not officially released yet, you might have hit a bug in the trial version, this might be fixed in the final release.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

THartl

@Yacine: Yes, with custom properties i meant the user-defined cells, you are right. Of course your approach of doing this, is the better, yet simplier and straighter way of doing this. But this what i described above is just a small snippets from a more complex operation. A Operation where we need the single points of the geometry keeping saved for later operations, so by the time when this module was coded it was the more appropriate way of doing this.
Sure, there are ways to workaround this behaviour in Visio 2013. But i wanted to find out, why this part of code has different behaviour in comparison to prior Visio Versions. Additionally this was just, what we encountered in a short time test of Visio 2013, who knows where we will find out more different behaviours due to ShapeSheet changes.

@Paul: Is it really not officially released yet? Well, this gives me small hope to not have this bug in final Version. Maybe i should open a ticket to visio Support. But why can we or our customers in Germany already order Visio 2013 from  (http://www.microsoftstore.com/store/mseea/de_DE/pdp/productID.263155900)

Paul Herber

Ok, maybe I'm out of date, I'd read that official release was due to be later this month.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

AndyW

It is released.

The RTM version has been available on volume licensing/MSDN subscription for a while too.
Live life with an open mind