VISIO 2007 drwaing control and templates

G

Gshell

In Visio 2003 when you set the SRC property to a template file, it created a
new document based on the template. This was just like right clicking on the
VST (template file) in Windows explorer and then selecting "New". In Visio
2007 this behavior is different. If you set the SRC property to a template
file it opens the template. This is just like right clicking on the VST
(template file) in Windows Explorer and then selecting "Open".

I have spent several hours tracing down some odd behavior with the Cross
Fundtional Flowchart template in Visio2007. What we have determined is that
"by design" the Visio team has changed the behavior to have it open the
actual template rather than opening a new document based on the template.
This means that any add-on that may be associated with the template is NOT
run. Under Visio 2003 the add-on was run. The support engineer I have been
working with is now asking the Visio team if there is a way to recreate the
way Visio 2003 handled setting the SRC property to a template file.

What this all boils down to is that the way Visio 2003 handled templates was
TECHNICALLY incorrect. When you set the SRC to a template it REALLY should
just open the template so you can make changes to the template. And they
FIXED this in Visio 2007. But it also appears that now there is no way to
create a new document based on a template.

I have a work around, at least for the Cross Functional Flowchart. I no
longer set the SRC property at all. Instead I start the add-on myself and
open the stencils myself. Problem with this is that I am not sure what ELSE
the template did besides those three things.

Sigh.

Gary
 
J

JuneTheSecond

I am sorry I could not found the difference.
My test code in Visio2007 and VB.Net2005 is listed below.
Both calls templates and set new drawing named as VisioDocument
on the drawing control.
Drawing control seems to me always set new drawing, VisioDrawing.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim openFileDialog1 As New OpenFileDialog()

openFileDialog1.InitialDirectory = "C:\Program Files\Microsoft
Office\Office12\1041\"
openFileDialog1.Filter = "Visio template (*.vst)|*.vst|All files
(*.*)|*.*"
openFileDialog1.FilterIndex = 2
openFileDialog1.RestoreDirectory = True

If openFileDialog1.ShowDialog() = DialogResult.OK Then
AxDrawingControl1.Src = openFileDialog1.FileName
Me.Text = AxDrawingControl1.Document.Name
End If

End Sub
 
G

Gshell

Try it with the Cross Functional flowchart template and tell me if it envokes
the add on which presents a dialog box asking about the number and
orientation of the lanes. I can tell you right now it won't. I have been
working directly with Microsoft support on this issue and THEY confirm the
specifcs of twhat I posted earlier.

Gary
 
J

JuneTheSecond

Thank you for your comments.
Now I see, there is something different.
In my test, when opened on drawing control,
the Drawing_Opened events issued,
but Drawing_Created events not issued
on both Visio 2003 and 2007.
I guess there is some kind of bug in addon or in Visio 2007.

Anyway, you can open the dialog when you drop the first xfun band
on your drwaing control.
 
G

Gshell

It is not a "bug" in the add-on or in Visio 2007. It is an intentional
change, but the VISIO development team, in the way Visio 2007 handles
templates. As I said, I have been working directly with Microsoft developer
support issue on this and the are the ones who told me that this was indeed
an intended change in how Visio handles templates.

Yes you are correct, that the add-on does run when you drop the first xfunc
band on the document, but you will notice that AFTER the add on has finished
that the lane you just dropped is no longer there. The add-on initializes
the document. There are other issues as well. Not the least of which is
that initially the stencils are not opened. Before you were able to drop
that first xfunc band, you had to open the stencil yourself, right?

As you noticed the Drawing_created event did not fire, this confirms the
"new" behavior that opening a template in Visio 2007 does NOT create a
document based on the template. All it does is open the template. If you
made a change and saved the current file, you would find that what you saved
was the template, not a document. That is a BIG difference.

All of this would be fine, and in fact I agree with the change the team has
made. It does allow for programmatic manipulation of templates, which was
not possible before. BUT, and this is the worrisome part, there now appears
to be no way to open a template using the "new" option, which creates a new
DOCUMENT based on the template.

As I said, I am still working with MS support on this case. They are asking
the development team if there is some way to create a document based on the
template. I'll report back their findings.

Gary
 
J

JuneTheSecond

Thank you for your information.
If it is their intention, I feel the intention lacks the consideration to
this matter.
 

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