Anwendungen entwickeln für Office 2007 Microsoft Office 2007 Anwendungen entwickeln für Office 2007 Jens Häupel Developer Evangelist Microsoft Deutschland GmbH http://blogs.msdn.com/jensha
Agenda Office 12 – die neue Erfahrung Das neue User Interface XML Dateiformate Ribbons Document ActionsPane vs. Custom TaskPane Add-Ins
Die neue Oberfläche von Office 2007
Elemente des neuen UI Enhanced Tooltips Contextual Tabs Live Preview Enhanced window frame Galleries Quick Access Toolbar Mini Toolbar Ribbons
Custom Ribbon Extensions Für Office 12 entwickeln Aufgaben automatisieren Berechnungen in Excel Dokumente ausfüllen Eigene Aktionen Benutzerdef. Ribbons erzeugen gebunden an Vorlage oder gesamte Anwendung Externe Funktionalität via Task Panes hinzufügen Core Tasks Task Panes Custom Ribbon Extensions
Das neue Dateiformat
Microsoft Office Open XML Formats Für Word, Excel und PPT XML und ZIP docx, xlsx, pptx Offenen und transparent ECMA: 4000 Seiten neue Integrationsszenarien ZIP Container = Standardkompression Bedeutend geringere Dateigrößen Einfacher Zugriff auf Inhalte
Open XML Format Architektur *.docx User-Sicht: eine einzelne Office “Datei” Entwickler-Sicht: modulare Datei Document Parts Fast alle Parts sind XML Jedes XML Part ist eine diskrete Komponente Einfaches Hinzufügen, Auslesen bzw. modifizieren individueller Parts ohne Office Öffnen der Datei trotz evtl. Fehler in bzw. Fehlen von Parts
Grundkomponenten Package PackagePart PackageProperties Der ZIP Container PackagePart Dateien im ZIP-Archiv Fast alles ist XML, binaräre Dateien möglich Jedes XML Part ist eine diskrete Komponente PackageProperties Dokumenteigenschaften PackageRelationship definieren die Beziehungen zwischen den Parts PackageDigitalSignature
DocPart-Struktur Relationship
Das neue Dateiformat
Vorteile des Formats Size matters Offenheit Vertrauen Sicherheit Privacy Robustheit Potential für Entwickler
Wie steht’s mit Kompatibilität? Format-Support bei alten Versionen Office 2000, XP und 2003 Öffnen, Bearbeiten and Speichern Binärformat kann Standardformat werden Beim Deployment oder später (Anwender) Binärformate von 97-2003 unterstützt Word-/SpreadsheetML ebenfalls unterstützt
Was ist mit VBA? docx, xlsx, pptx, … sind makro-freie Dateien explizit speichern als docm, xlsm, pptm, … ist angesagt Developer Ribbon muß aktiviert werden via Application Settings / Personalize
Aus Menüs werden Ribbons (Multifunktionsleisten)
Ribbon Components Zugriff auf Ribbon via Tab Ribbon enthält eine oder mehr Gruppen Eine Gruppe enthält ein oder mehr Controls Controls können gruppiert werden
Office UI anpassen Dokumentebene (statisch) Specific Doc/Template Doc Parts Custom UI Action Handlers Dokumentebene (statisch) Angepaßtes UI in Datei (Zip-Archiv) Action Handler in VBA Anwendungsebene (dynamisch) Angepaßtes UI dynamisch per .NET Add-In laden Action Handler innerhalb des Add-In verfügbar Any Document Custom UI Action Handlers Add-In
IRibbonExtensibility Interface GetCustomUI(string) Parameter: Ribbon XML File Deklaration der CallBack Handler im XML ribbon tabs tab group control Custom ribbon: - Office loads your add-in - Office queries your add-in to see if you implement IRibbonExtensibility (this interface has only one method). - Your add-in returns to Office the object that implements this interface. - Later, Office calls back (GetCustomUI) on that interface on that object to fetch your XML for your custom ribbon. - Office parses the XML and creates tabs, groups, controls according to the markup you supplied. - These controls are all unmanaged and belong to Office – you have no direct access to them at all. - When the user interacts with these controls, Office will call back on the IRibbonExtensibility object you provided earlier. Note that IRibbonExtensibility defines only one method (GetCustomUI), but you can implement as many additional arbitrary callback methods as you like, relying on the fact that IRibbonExtensibility is a dispatch interface. - So, when Office calls back to, say your custom OnMyToggleButtonMethod callback on your object, it is doing so using IDispatch::Invoke
* 19 ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
* 20 ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
RibbonExtensibility 21
TaskPane Integration
TaskPanes Document ActionsPane Custom TaskPane Dokumentzentrische Erweiterung SmartDocument Custom TaskPane Anwendungszentrische Erweiterung Basiert auf Add-In
Actions Pane Developer experience 1. Design a UserControl 2. Add control behaviour 3. Add the control to the ActionsPane
TaskPane Programmierung 25
Applikationszentrische Erweiterungenen (Als Add-In implementiert) Custom Task Tanes Ribbon Customization Outlook Custom Form Regions Dokumentzentrische Erweiterungen Document ActionsPane SmartTags
Isolated COM Add-Ins für Outlook
Back To The Roots: COM Office Security: Klasse muß signiert sein Container signiert mit Authenticode
Managed Code ist anders! CLR übernimmt die Ausführung Direkter Aufruf der ASM schlägt fehl Office Security: mscoree = System Komp. = nicht signierbar Ausweg: Office Security < High
Die Lösung des Problems Dedizierte unmanaged Shim (Proxy) Hosted die CLR Lädt ausschließlich eine ASM Ist selbst signiert Prüft ASM gegen CAS Policies
Add-In Architektur DefaultDomain Office Host App VSTO Runtime: AddinManager SecurityManager Office Host App AddinLoader IDTExtensibility2 Adapter AddinLoader IDTExtensibility2 Adapter Domain #2 Add-in AddinLoader IDTExtensibility2 Adapter Domain #3 Add-in Domain #4 Add-in
VSTO Add-Ins Supported Shim Verwendet bestehende VSTO Runtime Services AppDomain Isolation Separate Security Configuration Disconnect Unload Manifest-basierte Updates Starkes Sicherheits-Modell Visual Studio Projektvorlage
Cached Data Implications Office Dokumente auf dem Server verändern 1. Attribute the DataSet as Cached 2. The DataSet is Cached as an XML part Implications Office Dokumente auf dem Server verändern Offline Daten im Dok speichern Session State sichern
Zusammenfassung Office Programmierung, die Einfacher Sicherer Richtige Programmierung Ist und Zentrale Assembly-Verwaltung Einfache Updates Bietet.
Your potential. Our passion.
Resources The Future of Office The Future of Office Developer Home http://www.microsoft.com/office/preview/default.mspx The Future of Office Developer Home http://www.microsoft.com/office/preview/developers/default.mspx ECMA Standardization http://www.microsoft.com/office/preview/developers/ecmafaq.mspx Good Blogs http://blogs.msdn.com/brian_jones/default.aspx http://blogs.msdn.com/eric_carter/default.aspx http://blogs.msdn.com/mshneer/default.aspx http://blogs.msdn.com/johnrdurant/default.aspx http://blogs.msdn.com/vsto2 http://www.officezealot.com/vsto