We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Visio Dynamic Connector is not recognized by Aspose Diagram

Hi,

I have defined a Dynamic Connector on our custom Visio Stencil. However when I read this from Aspose Diagram it does not recongize it as a connector. It reads it as a shape. If this is the case how can I tell which shapes the connector is connecting to if it does not recognize it as a Dynamic Connector.

I have attached the Visio stencil file for your reference.

Thanks.

Anthony

Hi Anthony,


Thank you for your inquiry. After adding a Dynamic Connector to a Visio diagram, you can read it as a shape. Shape class will provide you a master name value as “Dynamic connector”. Please take a look at this code snippet:

//Name of the master present in the stencil<o:p></o:p>

string connectorMaster = "Dynamic connector";

int pageNumber = 0;

double width = 2, height = 2, pinX = 4.25, pinY = 9.5;

// Load masters from existing stencil

// and add in the new diagram

Diagram diagram = new Diagram(@"C:\test\FutureFleetIPAAStencil.vsx");

// Load an existing diagram

Diagram dgm = new Diagram(@"C:\test\input.vsd");

//Add a new dynamic connector shape

long connectorID = dgm.AddShape(

pinX, pinY, width, height, connectorMaster, pageNumber);

//Set the new shape's properties

Shape shape = dgm.Pages[pageNumber].Shapes.GetShape(connectorID);

Console.WriteLine("Name: "+shape.Master.Name);

I hope this will help you. Please let me know for further assistance and comments.

Did the last code sample actually work? Should it work if I create the Dialog with vss? Saying that Master with name ‘Dynamic connector’ does not present in the collection of Masters.

Hi Anthony,


Thank you for your inquiry. Yes, it should work in the case of VSS format too. Please make sure that the “Dynamic connector” master is present. I’ve updated above source code where we also need to add a master by calling AddMaster method. Please take a look:

//Name of the master present in the
stencil
<o:p></o:p>

string connectorMaster = "Dynamic connector";

int pageNumber = 0;

double width = 2, height = 2, pinX = 4.25, pinY = 9.5;

// Load masters from existing stencil

// and add in the new diagram

Diagram diagram = new Diagram(DirPath + "FutureFleetIPAAStencil.vsx");

// Load an existing diagram

Diagram dgm = new Diagram(DirPath + "Drawing1.vsd");

dgm.AddMaster(DirPath + "FutureFleetIPAAStencil.vsx", connectorMaster);

//Add a new dynamic connector shape

long connectorID = dgm.AddShape(

pinX, pinY, width, height, connectorMaster, pageNumber);

//Set the new shape's properties

Shape shape = dgm.Pages[pageNumber].Shapes.GetShape(connectorID);

Console.WriteLine("Name: " + shape.Master.Name);

Console.ReadKey();


Please refer to the programmer's guide:
http://www.aspose.com/docs/display/diagramnet/Home

Please do let us know in case of any confusion or questions.