Retrieving Connector Information
Contents
[
Hide
]
VSTO
Below is the code to get connector information:
foreach (Visio.Connect Connect in Application.ActiveDocument.Pages[1].Connects)
{
MessageBox.Show("\nFrom Shape ID : " + Connect.FromSheet);
MessageBox.Show("To Shape ID : " + Connect.ToSheet);
}
Aspose.Diagram
Aspose.Diagram for .NET provides mechanisms for retrieving information - ID and name - about pages and master. It also lets you get information about connectors, the elements that link shapes.
The Connect object represents a connector that joins two shapes on a Visio drawing page. The Connects property, exposed by the Page class supports a collection of Aspose.Diagram.Connect objects. This property can be used to retrieve ID and name information about a connector.
Below is the code to get connector information using Aspose.Diagram .NET:
//Call the diagram constructor to load diagram from a VDX file
Diagram vdxDiagram = new Diagram(@"E:\Aspose\Aspose Vs VSTO\Aspose.Diagram Vs VSTO Visio v1.1\Sample Files\Drawing1.vdx");
foreach (Aspose.Diagram.Connect connector in vdxDiagram.Pages[1].Connects)
{
//Display information about the Connectors
Console.WriteLine("\nFrom Shape ID : " + connector.FromSheet);
Console.WriteLine("To Shape ID : " + connector.ToSheet);
}
Console.ReadLine();