Add columns to an Entity using c#

Started by abeaulieu, February 08, 2013, 05:39:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

abeaulieu

Hi, read some article here and found most of what I was looking for, thanks.

Only one piece seems to be missing, but I read that it might be impossible, at least not with visio 2007 and lower. Hope that 2010 or higher have a solution.
I want to create a relationship diagram. I am using visio because the main functionality are there. But if anyone knows of another option I am open.

So short story: I select a file, from it, create some object (Diagram), and relationship between them.
For now, I just create 2 shape(Entity) and link them. Before going too far I need to know how to add columns in my Shape.

Here is my code so you know which Entity I am talking about.


            Visio.Documents visioDocs = Globals.ThisAddIn.Application.Documents;
            Visio.Document visioStencil = visioDocs.OpenEx("Basic Shapes.vss",
                (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);
            Visio.Document visioStencilEntity = visioDocs.OpenEx("Entity Relationship (US Units).vss",
                (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);

            Visio.Page visioPage = Globals.ThisAddIn.Application.ActivePage;

            Visio.Master visioEntityMaster = visioStencilEntity.Masters.get_ItemU(@"Entity");
            Visio.Shape visioEntityShape = visioPage.Drop(visioEntityMaster, 3, 3);
            Visio.Shape visioEntityShape1 = visioPage.Drop(visioEntityMaster, 5, 3);

            Connect(visioEntityShape, visioEntityShape1, visioPage.Drop(visioStencil.Masters["Dynamic connector"], 0, 0));


Thanks in advance,
Alex