Free Support Forum - aspose.com

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);
}
}
}

TestContainer.zip (23.1 KB)

Thanks a lot.

@marchuber,

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.