Visio Guy

Visio Discussions => Programming & Code => Topic started by: RhesusMinus on January 28, 2011, 08:53:13 AM

Title: Is it possible to detect wether a shape is just a text shape, with no geometry?
Post by: RhesusMinus on January 28, 2011, 08:53:13 AM
I have created a group with 2 sub shapes. One is a rectangle, and one is a text. I need them to be separate.
However..I'm not able to programatically see the difference between the 2 sub shapes. They both have a GeometryCount of 1, and the rectangle CAN contain a text as well, so I can't just check the text property either.

How can I identify the text only shape?

THL
Title: Re: Is it possible to detect wether a shape is just a text shape, with no geometry?
Post by: Paul Herber on January 28, 2011, 09:26:59 AM
The only real difference is a text shape has LinePattern = 0.
Title: Re: Is it possible to detect wether a shape is just a text shape, with no geometry?
Post by: RhesusMinus on January 28, 2011, 09:52:27 AM
Well, if that is consistent, then I can use that :)

Thanks!

THL
Title: Re: Is it possible to detect wether a shape is just a text shape, with no geometry?
Post by: RhesusMinus on January 28, 2011, 09:53:33 AM
Did you mean LineStyle?

THL
Title: Re: Is it possible to detect wether a shape is just a text shape, with no geometry?
Post by: RhesusMinus on January 28, 2011, 10:01:30 AM
Nah.. found it :)

THL
Title: Re: Is it possible to detect wether a shape is just a text shape, with no geometry?
Post by: Nikolay on January 29, 2011, 05:54:45 PM
Quote from: RhesusMinus on January 28, 2011, 08:53:13 AM
I have created a group with 2 sub shapes. One is a rectangle, and one is a text. I need them to be separate.
However..I'm not able to programatically see the difference between the 2 sub shapes. They both have a GeometryCount of 1, and the rectangle CAN contain a text as well, so I can't just check the text property either.

How can I identify the text only shape?

Hi,

Maybe if all you actually want to do is to identify the shapes, it might be a good idea to simply mark them beforehand?!
I mean, to tag the shapes you want to identify, e.g. tag the rectangle shape with a mark "rectangle", and the text shape with a mark "text".
So later you could simply look at the tag of the shape you are processing and tell what it is.

You could implement this marking using custom properties (http://office.microsoft.com/en-us/visio-help/about-custom-properties-HP085050535.aspx), user-defined cells (http://msdn.microsoft.com/en-us/library/aa200962.aspx#575), or even the (already fossilized?) Data1/Data2/Data3 (http://msdn.microsoft.com/en-us/library/ms425982.aspx) shape attributes

Keep in mind that Visio provides powerful and easy to use tools to show text items on a shape nowadays, e.g. text fields (http://office.microsoft.com/en-us/visio-help/creating-text-fields-to-display-information-in-visio-HA001182249.aspx), or data graphics (http://www.visguy.com/2007/05/04/data-graphics-resources/) were specifically designed for this.
You might want to check these out if you haven't done it yet!
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 56 (show)
Files included: 25 - 925KB. (show)
Memory used: 762KB.
Tokens: post-login.
Cache hits: 7: 0.00120s for 22,301 bytes (show)
Cache misses: 1: (show)
Queries used: 9.

[Show Queries]