Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to draw a Visio file diagram by extracting values from an excel file. I have the following columns in Excel file :
• StepNo (Unique identifier for each Process)
• Source System (Text to be written in the Process)
• Destination System (Unique identifier for Process to which connection is to be made)
• Interaction info ( Text to be written on the connector)

Using the following code, I’m able to connect Source and Destination Process (Visio shapes) :

private static void ConnectShapes(Shape shape1, Shape shape2, Shape connector)
        {
            // get the cell from the source side of the connector
            Cell beginXCell = connector.get_CellsSRC(
            (short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

            // glue the source side of the connector to the first shape
            beginXCell.GlueTo(shape1.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXFormOut,
            (short)VisCellIndices.visXFormPinX));         

            // get the cell from the destination side of the connector
            Cell endXCell = connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXForm1D,            
                (short)VisCellIndices.vis1DEndX);

            // glue the destination side of the connector to the second shape
           endXCell.GlueTo(shape2.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowXFormOut,            
            (short)VisCellIndices.visXFormPinX));

            // add an arrow to the connector on its end point            
            Cell arrowCell = connector.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowLine, (short)VisCellIndices.visLineEndArrow);
            arrowCell.FormulaU = "5";            
        } 



My Problem is I’m not able to determine the position of connection points in Source and Destination Systems. When the excel file values become complex, too many connections are to be made. So, the connectors are overlapped over one another. Is there any method by which I can determine the connection points and thus avoid the overlapping?
Posted
Updated 17-May-12 1:10am
v2

1 solution

I haven't managed to create non-crossing connections yet, but found an interesing article that helped me figure out how to work with Visio from C#. Has an easy to follow example with source code too.

http://www.syntaxwarriors.com/2012/generating-visio-uml-diagrams-from-c/
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900