Database shape


I

Ishmael

Hi,

I want to programatically do a database diagram. For that i would like to
use the Tables shapes that already exist in Visio. Is it possible? if so,
does anyone have a code snippet that shows how to call them?

Thanks
 
Ad

Advertisements

S

shashi behari

It's possible.. all you need to do is call the correct stencil and master
name and programmatically drop the shapes on the page. something like this

//to get the database stencil
stencil = visioDocuments[stencilName];

//to get the master shape from the stencil
masterInStencil = stencil.Masters.get_ItemU(masterNameU);

//add it to the page
visioPage.Drop(masterInStencil, pinX, pinY);

then set up your relationships and Primary/Foreign keys, which i've never
done before but im sure it wouldn't be hard to figure out.

for more code samples, check the Visio SDK.
 
Ad

Advertisements

M

Matt

I think the caller is interested in how to add columns, indexes, triggers,
setting up relationships etc. Dropping a share onto a page is pretty
rudimentary by now and there are plenty of examples out there.
I am interested in this as well. I saved a Visio document containing a
simple table with columns, index, etc and saved it as xml drawing hoping that
I could reverse engineer some bits and pieces to help me generate a similar
xml in code but I could not find some of the data that I specified in the xml
file. So I am not sure where and how they are stored. I saw some what
appeared to be encoded sections in the xml. My data has to be in there I
assume. I also tried recording a macro while I intereacted with the Visio
database shapes such as adding columns etc but the resulting macro did not
have anything. I have the Visio 2003 SDK and it comes with Visio Event
monitor. I was able to see some events in there while I added new columns,
changed notes, etc These events included FormulaChanged, CellChanged, etc but
I did not find this information easy to figure things out to code something
using it.

Sooo, anyone has any examples of how to programmatically create a database
diagram and configuring the shapes like adding columns, indexes,
relationships to a database table?

Matt

shashi behari said:
It's possible.. all you need to do is call the correct stencil and master
name and programmatically drop the shapes on the page. something like this

//to get the database stencil
stencil = visioDocuments[stencilName];

//to get the master shape from the stencil
masterInStencil = stencil.Masters.get_ItemU(masterNameU);

//add it to the page
visioPage.Drop(masterInStencil, pinX, pinY);

then set up your relationships and Primary/Foreign keys, which i've never
done before but im sure it wouldn't be hard to figure out.

for more code samples, check the Visio SDK.

Ishmael said:
Hi,

I want to programatically do a database diagram. For that i would like to
use the Tables shapes that already exist in Visio. Is it possible? if so,
does anyone have a code snippet that shows how to call them?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top