Visio Guy

Visio Discussions => Programming & Code => Topic started by: fvenezia65 on January 13, 2020, 09:45:11 PM

Title: unable to ungroup a shape and then read the text of that ungrouped shape with ps
Post by: fvenezia65 on January 13, 2020, 09:45:11 PM
hi, everyone.
i am able to read the text of all the shapes in a visio file, except for text in any shape that is "grouped".
i do seem to be able to loop through all the shapes and ungroup the "grouped shapes", but i haven't hit on the technique to re-read the ungrouped shapes and then find the text i am after.
any ideas?
i am using powershell and the visio PS module version 2.25.0 along with Visio-2013.
thank you!
-frank
Title: Re: unable to ungroup a shape and then read the text of that ungrouped shape with ps
Post by: Paul Herber on January 13, 2020, 09:56:36 PM
There is no need to ungroup shapes. Ungrouping shapes breaks them and any text in the group part is lost. Read the group's sub-shapes. The group has a Shapes.Count > 0

Title: Re: unable to ungroup a shape and then read the text of that ungrouped shape with ps
Post by: fvenezia65 on January 17, 2020, 07:34:45 PM
Thank you, Paul.
The funny thing is...i can ungroup the shape with the text i am after, and then save the file.
when i pass the ungrouped file to my script, it can then find the text.
i will try that count property.
have a great weekend!
-frank
Title: Re: unable to ungroup a shape and then read the text of that ungrouped shape with ps
Post by: Paul Herber on January 17, 2020, 08:24:50 PM
Do not ungroup shapes, it does not help and breaks the shape, permanently. Any properties of the top-level shape are then lost.
You need to recurse down through the sub-shapes, the text may be in any one or more of the sub-shapes, could be several layers down.