Yesterday Eric Carter, Martin Sawicki, both are Program Managers of the VSTO team at Microsoft Corp. in Redmond and I delivered a whole pre-conference on VSTO at TechEd Europe: Developers in Barcelona. I delivered a pre-conference with deep technical details on Visual Studio 2005 Tools for Office. You can find the downloads here within this blog-entry.
Primarily I did the part on ActionsPane and Smart Documents based on VSTO 2005 based on the experience I made about a year ago within the Smart Docs project we did with Data Systems Austria, one of the largest ISVs in Austria. I primarily covered the following parts and demos:
- What makes a Smart Document really "Smart"?
- DEMO on building context sensitive Smart Documents with Word
- Smart Tags and how they can be programmed in VSTO 2005 Doc-Level customizations
- DEMO on building a Smart Tag together with using ActionsPanes within a Word Document
- Schema Design proven practices for creating Smart Documents as well as archtectural guidance on create VSTO Smart Document solutions for large enterprise projects.
- DEMO on building re-usable UI-controls that can be used in WinForms and VSTO Office solutions.
Finally the re-usabiltiy demo was a good indicator for me to show, how you can use Windows Presentation Foundation controls within an Office solution. Fortunately with the Windows Forms Integration Assemblies that is fairly easy. All you need to do is developing a WPF control and then adding a reference within your VSTO solution to that WPF control. In addition you need to add references to the WPF-required .NET 3.0 assemblies which are WindowsBase.dll, WindowsFormsIntegration.dll, PresentationCore.dll and finally PresentationFramework.dll. With the following code then you can add the WPF control to your Office Document Actions Pane:
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
// This is required for Windows Forms Interoperability
publicpartial class ThisDocument
private TestWPFControl.UserControl1 ucWPF = new TestWPFControl.UserControl1();
private void ThisDocument_Startup(object sender, System.EventArgs e)
ElementHost host = new ElementHost();
host.Height = 400;
host.Child = ucWPF;
You can find all the code-samples from the session including the WPF demo within the downloads of this blog post.
Finally we had about 160 attendees in both pre-conferences of my track - the SharePoint pre-conf and the VSTO pre-conf which is pretty cool. I hope you enjoyed it - for us it was definitely a great experience;)