Free Support Forum -

Get text from visio container

How can we get the text also from a container in a visio file. With the following code only text from shapes will be extracted (the text “Container” is missing):

foreach (Diagram.Page page in diagram.Pages)
foreach (Diagram.Shape shape in page.Shapes)
FormatTxtCollection collection = shape.Text.Value;
foreach (object text in collection)
if (text is Txt)
plainText.Append((text as Txt).Value);
} (23.1 KB)

Thanks a lot.


Please try the code snippet as documented in this help topic: Extract Plain Text from the Visio Diagram Page. It works fine and retrieves “Container” text in our environment.

Perfect example. Works. Thanks.