Shape Data "Label.Value" is returning empty string when a Label exists

Hello everyone,

I am using the Aspose.Diagrams trial full license to read Shape Data property tables from .VSD files. I have many .VSD files containing Shapes with “Shape Data” tables that have a “Label” and a “Value” that I need to read, example screenshot here:

image.png (10.3 KB)

And here is an example .VSD file I am trying to read from: Box

However, the following code will often return an Empty String for the “property.Label.Value” call, even though I can see in the .VSD file that the Shape Data table has a Label with a non-empty string (e.g. “Description”). I need to be able to read this Label value, so this code returning Empty Strings for the Label is confusing to me. Is there something I might be missing in reading the Label from the property table?

foreach (FileInfo file in _ddcVisioFilesToRead)
                {
                    Diagram diagram = new Diagram(file.FullName);
                    Console.WriteLine("Processing file: " + file.Name);

                foreach (Page page in diagram.Pages)
                {
                    foreach (Aspose.Diagram.Shape shape in page.Shapes)
                    {       
                        Console.WriteLine("Processing shape: " + shape.Name + " in Page: " + page.Name);

                        foreach (Prop property in shape.Props)
                        {
                            //TODO: Property Label is often returning empty string, when the shape does actually have a Label string. 
                            if (property.Label.Value == "Description")
                            {
                                Console.WriteLine(property.Label.Value + ": " + property.Value.Val);
                            }
                            else if (property.Label.Value == "Input" || property.Label.Value == "Output")
                            {
                                Console.WriteLine(property.Label.Value + ": " + property.Value.Val);
                            }

                        }
                    }
                }
            }

For the example Shape Data table, I am able to read the “property.Value.Val” of “BV-37” in Visual Studio:
image.png (1.5 KB)

But for the same property, the “property.Label.Value” is empty in Visual Studio (while the Visio screenshot shows the Label as “Output”):
image.png (1.5 KB)

What is also strange is that I wrote some code using the Microsoft.Office.Interop.Visio library to manually open the file in Visio Studio and read Shape Data properties, and I am able to read the Label Value with no issue.

@sbisher

We have logged an investigation ticket as DIAGRAMNET-52047 in our issue management system to further analyze this case. We will look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We apologize for the inconvenience.

Thank you @asad.ali, I look forward to hearing your findings.

@sbisher

Please try to use shape.InheritProps to get shape props which inherit its master. Please try this sample code then you will get the right value:

Console.WriteLine(shape.InheritProps[0].Label.Value);
Console.WriteLine(shape.InheritProps[0].Prompt.Value);
Console.WriteLine(shape.InheritProps[0].Value.Val); 
1 Like

@asad.ali Apologies for my late response to this. Your suggestion worked like a charm, thank you for the assistance!

1 Like