J
Jonathan Spane
Hi everyone,
I currently have a Visio Add-On in C++ that is reading a custom XML file
that creates a stencil with shapes. These shapes have custom properties as
defined by the XML.
With this stencil I proceed to make a drawing with no problems. Here is
where it gets interesting. There will be times where this custom XML will be
updated with new shapes, new properties, or existing shapes will have new
properties defined with them. Here is what I do when that happens in pseudo
code when I read this XML file in.
I close the existing stencil.
I then add new empty stencil by a default name.
I then add the shapes to this stencil with custom properties.
I then save this default stencil as the same name as the old stencil thus
overriding it.
After updating the stencil, I then find the active drawing and try to update
the instance shapes with their new properties based on what was just done to
the stencil.
Most of the time this seems to work. My problem is I sometimes try to get
the shape name in the active drawing and it says it is called "Sheet.#".
Where # is some index. This is weird since this same shape was called
something completely different before I reimported the XML file. It seems
like creating a new stencil has does something to the instanced shapes
intermittently. Once this instanced shape becomes like this, there is new
way to get it working. I have to delete the shape and start over. The other
weird thing is if I look at the custom properties window it displays the
correct name of the instanced shape in title bar. This proves is used to be
named correctly.
Any ideas on how I should approach this problem? I have tried setting the
local name and universal name of the shape. Also, this problem does not seem
to affect every instanced shape. It seems to be random. This is going to be
a problem. If you made it this far thanks for reading.
JP
I currently have a Visio Add-On in C++ that is reading a custom XML file
that creates a stencil with shapes. These shapes have custom properties as
defined by the XML.
With this stencil I proceed to make a drawing with no problems. Here is
where it gets interesting. There will be times where this custom XML will be
updated with new shapes, new properties, or existing shapes will have new
properties defined with them. Here is what I do when that happens in pseudo
code when I read this XML file in.
I close the existing stencil.
I then add new empty stencil by a default name.
I then add the shapes to this stencil with custom properties.
I then save this default stencil as the same name as the old stencil thus
overriding it.
After updating the stencil, I then find the active drawing and try to update
the instance shapes with their new properties based on what was just done to
the stencil.
Most of the time this seems to work. My problem is I sometimes try to get
the shape name in the active drawing and it says it is called "Sheet.#".
Where # is some index. This is weird since this same shape was called
something completely different before I reimported the XML file. It seems
like creating a new stencil has does something to the instanced shapes
intermittently. Once this instanced shape becomes like this, there is new
way to get it working. I have to delete the shape and start over. The other
weird thing is if I look at the custom properties window it displays the
correct name of the instanced shape in title bar. This proves is used to be
named correctly.
Any ideas on how I should approach this problem? I have tried setting the
local name and universal name of the shape. Also, this problem does not seem
to affect every instanced shape. It seems to be random. This is going to be
a problem. If you made it this far thanks for reading.
JP