Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005.

Similar presentations


Presentation on theme: "Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005."— Presentation transcript:

1 Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005

2 CLT330: Building Office solutions using Visual Studio 2005 Tools for Office Paul Foster Developer Evangelist Microsoft

3 Agenda Why? VSTO Internals VSTO SmartTags VSTO Outlook Add-ins

4 ITBusiness Business Practice Business Functions Applications Infrastructure judgment insight tradeoffs change oversight strategy Reconciling IT and Business

5 Business Applications Business Practice Infrastructure Business Functions Applications Infrastructure Collaborate DecideActInsight Oversight The Agile Business

6 Turning Leads Into Gold Clarify MS Sales Alchemy Siebel Elixir Curing What Ails CRM

7 Complementary client Enables wider use of system assets Adds value to systems Near to zero training

8 Visual Studio Tools for Office Version 2005 Major focus on developer productivity Integrated design-time experience Support for managed controls Extended Office controls (“Host” controls) Managed Document Actions task pane Schema-based programming model New data caching capabilities (CT340) Data cache accessible in server environments Robust security and deployment (CT340)

9 VSTO Internals

10 Core elements Host Item & Host Item Base Host Item Controls Namespaces Microsoft.Office.Interop.Excel vs. Microsoft.Office.Tools.Excel

11 Host Item Base (Microsoft.Office.Tools.Excel.Worksheet) Host Item User Code (Sheet1.cs) Host Item Hidden Code (Sheet1.designer.cs) Control (M.O.T.E.Range) Microsoft.Office.Interop.Excel.Worksheet Microsoft.Office.Interop.Excel.Range Code and namespace map

12 Host Item Features Partial Class User & Generated Portions IStartup Entry Point for User Code Components Host Item Controls Cached Data Globals Extensible

13 Easy to Get to Host Controls Globals class provides properties: Each Host Item appears as a "top-level" property In Excel: Globals.ThisWorkbook, Sheet1, and so on In Word: Globals.ThisDocument

14 What do host controls give us? Promote items of interest into your programming model Office development feels more like.NET Windows forms development Can handle events at control level, rather than at document level Can modify properties at design time All view controls support binding ListObject supports complex data binding Added "correct" functionality But no existing code broken

15 Programming models Office application API View programming model Data programming model Loosely coupled View model connected by data binding to data model View model connected to Host API

16 The Old Way Write a value to a cell? Developer must have intimate knowledge of the layout And the object model: Workbooks(1).Sheets(1).Range("$A$2").Value = 12345

17 Host Controls Make It Easy Create a named range Set the formula: Can program view properties, as well: CustomerIDCell.Formula = 12345 CustomerIDCell.AddComment("New customer") CustomerIDCell.ColumnWidth = 50 CustomerIDCell.Interior.ColorIndex = 5

18 VSTO solution review Demos in this section: Correcting book mark Old Host API to change a value in Excel New view model to change a value in Excel New data model to change a value in Excel

19 Managed Controls Managed Windows Forms Controls are available: On document or worksheet surface On a Windows Form On the Actions Pane Drag from the Toolbox May be dynamically added/removed at runtime Third-party/custom.NET user controls supported

20 Hosting Managed Controls Managed controls hosted in ActiveX wrapper (extender) Some properties relate to the wrapper instead of the document Anchor, Dock, Location, for example Check formula bar in Excel for hint at the magic: COM ProgID is Winforms.Control.Host =EMBED("Winforms.Control.Host", "")

21 VSTO solution review Demos in this section: Kathrine’s container demo for top and left Discuss Value2 Point out Excel formula entry

22 Why Embed in ActiveX? Main reason: Security Can't embed a managed control unless VSTO security knows about it By default, in VSTO, no code runs Requires explicit permissions to execute Requires stronger evidence than just being installed locally—that's not enough Managed control is created in same AppDomain as customization Subject to the same security policy Need something in the document in case security doesn't allow control to load ActiveX control stays in document either way

23 Why Embed in ActiveX? Second reason: COM registration To embed each managed control individually… Would require creating a COM-callable wrapper for each control How do you register? Using Winforms.Control.Host requires only one ActiveX control to be registered Actually, one more layer involved: See Eric Carter's blog (reference at the end) for more information

24 Agenda Why? VSTO Internals VSTO SmartTags VSTO Outlook Add-ins

25 VSTO SmartTags

26 SmartTags Overview What is a SmartTag? Supplies context-based actions What makes up a SmartTag? Recognized Text Actions

27 Developing VSTO SmartTags Create a SmartTag instance Add strings to recognize Literal strings, or RegEx Add available actions Register SmartTag object with the document

28 Create a SmartTag Instance Constructor Parameters SmartTag Type Caption Example Code: Microsoft.Office.Tools.Excel.SmartTag myTag = new Microsoft.Office.Tools.Excel.SmartTag(“www.example.com#prodInfo”, “Product Info”);

29 Add Strings to Recognize Terms Collection Static Strings Expressions Collection Regular Expressions ' Recognize US$ values. ' Need to revisit for international situations! Me.Expressions.Add( _ New Regex("\$?([1-9]{1}[0-9]{0,2}(\,\d{3})*(\.\d{0,2})?)"))

30 Add Available Actions Create Action Objects Excel: Microsoft.Office.Tools.Excel.Action Word: Microsoft.Office.Tools.Word.Action Set Caption property in constructor ' In the class Dim WithEvents lookupAction As Action ' In the constructor lookupAction = New Action("Convert to Text") Me.Actions = New Action() {lookupAction}

31 Handle Action Click Event Add code to take action on click Private Sub lookupAction_Click( _ ByVal sender As Object, _ ByVal e As Microsoft.Office.Tools.Word.ActionEventArgs) _ Handles lookupAction.Click e.Range.Text = My.WebServices.Numbers.NumToStr( _ Decimal.Parse(e.Text, _ Globalization.NumberStyles.Currency)) & " dollars" End Sub

32 Register SmartTag with Document VstoSmartTagsCollection Excel: ThisWorkbook class Word: ThisDocument class Implications of registering Can only set Actions property before adding to VstoSmartTagsCollection Use RecheckSmartTags to force check for recognized text Me.VstoSmartTags.Add(New NumberToTextSmartTag())

33 VSTO SmartTags

34 Agenda Why? VSTO Internals Architecture Runtime storage engine and custom properties Host items and Host controls Managed controls VSTO SmartTags VSTO Outlook Add-ins

35

36 Motivations for Enabling Outlook Extensibility in VSTO A lot of people “live” in Outlook Email and tasks part of typical business process and document workflow Desire for single interface for multiple back- end systems Reduced training and expanded access as a result of familiar Office UI

37 Developing Outlook Solutions with Visual Studio 2005 Tools for Office Application-level solutions (Add-ins) Newly added, post-Beta 2! What does VSTO provide? VS project template for Outlook Add-ins Add-in loader component Leverages existing VSTO infrastructure Provides infrastructure for secure and robust Outlook Add-ins Visual Studio snippets and samples for common Outlook development tasks

38 Outlook Add-in issues to date COM world, Adds-in need registration To shim or not to shim Developers need to code around Outlook shutdown issues Add-in security Authenticode signing of COM add-in/shims VSTO resolves with common AddinLoader and standard VSTO runtime

39 AddinLoader architecture Unmanaged codeManaged code Office (Outlook) Host Application Addinloader.dll Addinloader IDTExtensibility2 Addinloader.dll Addinloader IDTExtensibility2 Addinloader.dll Addinloader IDTExtensibility2 Default Domain Add-in Domain #2 Managed Add-in Add-in Domain #3 Managed Add-in Add-in Domain #n Managed Add-in VSTO Runtime AppDomain Provider Security Manager

40 Registry detail for Add-in

41 Loading an Add-in

42 Visual Studio 2005 Tools for Office Project Template

43 Outlook Add-ins: Hello World

44 Resources Office Developer Center: http://msdn.microsoft.com/office http://msdn.microsoft.com/office http://blogs.msdn.com/johnrdurant VSTO Outlook HOL VSTO Outlook Articles VSTO Solution Sample VSTO Outlook Snippets VSTO Outlook Feature Samples VSTO in-the-box Documentation

45 Summary Visual Studio Tools for Office enables developers to leverage the rich UI and functionality of Office Visual Studio Tools for Office makes Office development approachable to the professional developer All the productivity of Visual Studio All the power of the.NET Framework Visual Studio Tools for Office 2005 provides key developer productivity enhancements Integrated design-time experience Managed Document Actions task pane (ActionsPane) Managed controls and Host controls

46 Call to Action Learn about the new platform features provided in Office 2003 that are targeted at application development XML file formats; reference schemas Support for mapping custom XML schemas Document Actions task pane Identify core tasks where the user would benefit from working within Word or Excel Provide VSTO solutions for these tasks Identify information managed by your product that is likely to end up in Word documents and Excel spreadsheets Provide reusable controls with your product Provide sample VSTO solutions that may be tailored by/for your customers

47 Learning More MSDN Developer Centers VS.NET and Office Development http://msdn.microsoft.com/vstudio/office/http://msdn.microsoft.com/vstudio/office/ Office Development http://msdn.microsoft.com/officehttp://msdn.microsoft.com/office VSTO 2005 Web casts http://msdn.microsoft.com/office/understanding/vsto/multimedia/default. aspx http://msdn.microsoft.com/office/understanding/vsto/multimedia/default. aspx Product team blogs Eric Carter: VSTO 2.0 Managed controls http://blogs.msdn.com/eric_carter/archive/2004/06/04/148819.aspx Peter Torr : Office Development, Security, Randomness… http://weblogs.asp.net/ptorr/ http://weblogs.asp.net/ptorr/ Eric Lippert : Fabulous Adventures in Coding http://blogs.msdn.com/EricLippert http://blogs.msdn.com/EricLippert Paul Stubbs : Office Development with.NET http://weblogs.asp.net/pstubbs http://weblogs.asp.net/pstubbs VSTO 2005 Team Blog: http://weblogs.asp.net/vsto2http://weblogs.asp.net/vsto2

48

49 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

50 Host items and Host Controls Host Items Visual representation of a class Provide a means for displaying data Excel Worksheet class Word Document class Host Items can contain Host controls Excel: NamedRange and List Object Word: Bookmark and XMLNode Native objects mapped to Host controls Support standard data binding


Download ppt "Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005."

Similar presentations


Ads by Google