Get Visio Shape Including Child
Contents
[
Hide
]
Retrieve a Visio Shape Including Child
Each shape in a diagram has an ID and a name. The ID is important when programming with Visio: it is the main method for accessing a shape. Each shape also retains information about what master (stencil) it is made from.
A Shape is an object in a Visio drawing which possibly hava a father or sons. The Shapes property, exposed by the Page class, supports a collection of Aspose.Diagram.Shape objects. The Shapes property can be used to retrieve information about a shape.
Retrieve Visio Shape Programming Sample
The following code snippet retrieve the shape including child. Please check this sample code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "NetworkConnection.vsdx"); | |
Page page = diagram.Pages[0]; | |
Shape shapeContainerChild = page.Shapes.GetShapeIncludingChild("RectangleChild"); | |
if (shapeContainerChild == null) | |
throw new Exception(); | |
// Save visio diagram | |
diagram.Save(dataDir + "GroupShapes_out.vsdx", SaveFileFormat.VSDX); |