L
Lars
I try to write an application in VC++ which performs the
following steps by automation:
1. run Visio
2. create a new document
3. drawing some shapes
4. link them together
5. save the document
6. quit visio
I only have problems with steps 3 and 4. Seems like such
an easy task but how can I create a shape (from standard
floatdiagrams)
and put it onto the page/document. The shapes should have
a special ID, more than tree data fields and a specific
text.
How will work this? And how can link two shapes together?
I used the following code. I would be very happy if
anyone could help me. I'm a newby in this case, so code
samples will be very helpfull.
if(!app.CreateDispatch("Visio.Application"))
{
AfxMessageBox("Couldn't start Visio and get
Application object.");
return;
}
else
{
// this work
app.GetApplication();
app.SetAutoLayout(TRUE);
docs = app.GetDocuments();
doc = docs.Open("BASFLO_M.vst");
// this doesn't work
shape.Import("BASFLO_M.vss");
shape.SetStyle("Process");
shape.SetName("This is a Test Shape");
shape.SetData1("First value");
shape.SetData2("Second value");
shape.SetData3("Third value");
page.Drop(shape, 10, 10);
// this work
doc.SaveAs("C:\\Temp\\test.vsd");
app.Quit();
}
thanks for your help,
regards Lars
following steps by automation:
1. run Visio
2. create a new document
3. drawing some shapes
4. link them together
5. save the document
6. quit visio
I only have problems with steps 3 and 4. Seems like such
an easy task but how can I create a shape (from standard
floatdiagrams)
and put it onto the page/document. The shapes should have
a special ID, more than tree data fields and a specific
text.
How will work this? And how can link two shapes together?
I used the following code. I would be very happy if
anyone could help me. I'm a newby in this case, so code
samples will be very helpfull.
if(!app.CreateDispatch("Visio.Application"))
{
AfxMessageBox("Couldn't start Visio and get
Application object.");
return;
}
else
{
// this work
app.GetApplication();
app.SetAutoLayout(TRUE);
docs = app.GetDocuments();
doc = docs.Open("BASFLO_M.vst");
// this doesn't work
shape.Import("BASFLO_M.vss");
shape.SetStyle("Process");
shape.SetName("This is a Test Shape");
shape.SetData1("First value");
shape.SetData2("Second value");
shape.SetData3("Third value");
page.Drop(shape, 10, 10);
// this work
doc.SaveAs("C:\\Temp\\test.vsd");
app.Quit();
}
thanks for your help,
regards Lars