RE: VISIO 2007 drawing control and templates

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

"JuneTheSecond" wrote:

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 drawing control.
--
JuneTheSecond



"Gshell" wrote:

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

"JuneTheSecond" wrote:

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
--
JuneTheSecond

.


Quantcast