Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12
Marcel Gnoth, © Zur Person Dipl. Inf. Marcel Gnoth, MCSD Senior Consultant, Avanade Deutschland GmbH Office Business Application Group & Business Intelligence Autor dotnetpro, dotnet-magazin, Developerworld, MSDN Sprecher BASTA!, TechTalk, SQL Server Days, NRW06 Themen Verteilte nachrichtenbasierte Informationssysteme MS Message Queueing, SQL Server Service Broker Office System 2003 / 2007 Integration BI, ETL, Reporting VB6, COM, SQL Server,.Net
Marcel Gnoth, © Über Avanade Gegründet als Joint Venture von Accenture und Microsoft im April 2000 Focus auf MS Technologien Anbindung an SAP und andere Systeme Ein führender Technologie-Integrator mit über Mitarbeitern in 21 Ländern Unternehmenslösungen auf Basis von Microsoft- Technologien über Projekte bei rund Kunden weltweit
Marcel Gnoth, © fach stark Umfassende Anwendungsentwicklung, Infrastrukturlösungen und Integration modernster Technologien Flexible und innovative Software Fundierte Industrie- erfahrung und Unter- nehmenslösungen Im Team bieten wir unseren Kunden passende Unternehmenslösungen an
Marcel Gnoth, © Globale Präsenz Avanade wächst stetig und zählt im Februar 2006 mehr als Mitarbeiter in 21 Ländern, sowie über Projekte bei rund Kunden. Avanade Americas Seattle San Francisco Chicago Dallas Boston New York Toronto St. Louis Nashville Kansas City Cincinnati Avanade Europe Almere Barcelona Brussels Copenhagen Edinburgh Helsinki Kronberg London Málaga Madrid Milan Oslo Paris Rome Stockholm Zurich Avanade Australia Sydney Melbourne Brisbane Canberra Avanade Asia Singapore Kuala Lumpur Bangkok Tokyo Avanade India Mumbai Bangalore Hyderabad Avanade Philippines Manila
Marcel Gnoth, © Unsere Kunden (Europa, Auszug)
Marcel Gnoth, © Agenda – Was gibt es neues Überblick Microsoft Office Open XML Formats (Office XML Formats) Word, Excel, PowerPoint Vortrag von Jens Häupel, OFF 4 Content Controls und XML – Mapping Taskpanes auf Applikation Ebene Ribbon - User Interface Word, Excel, PowerPoint Vortrag von Jens Häupel, OFF
Marcel Gnoth, © VSTO – Zwischenrelease Office Visual Studio 2005 VSTO 2005 Cypress Visual Studio 2005 Tools for Office Second Edition (VSTO 2005 SE) default.aspxhttp://msdn.microsoft.com/office/tool/vsto/2005SE/ default.aspx Beta Office VSTO V3 Nächste Visual Studio Version (Orcas)
Task Panes & Actions Panes Applikationsbezogenes UI
Marcel Gnoth, © Taskpanes Windows Froms Userinterface Integriert in Office Office 2003: Auf Dokumentebene Dokument Aktionen Office 2007 Auch auf Applikationsebene Aufgabenbereich
Marcel Gnoth, © Dokument Aktionen Taskpane ist mit dem geladenen Dokument verbunden Auch Actions Pane genannt ISmartDocument Technologie Im Dokument ist ein Verweis Assembly gespeichert Runtime Storage Control Application Manifest Assembly wird geladen
Marcel Gnoth, © Custom TaskPanes Neues ICustomTaskPaneConsumer Interface Neues Projekt: AddIn
Marcel Gnoth, © Custom TaskPanes Dll Projekt UserControl hinzufügen Excel startet beim Debuggen Neue Taskpane mit UserControl erstellen Private Sub ThisApplication_Startup(…) Handles Me.Startup Dim ctp As Microsoft.Office.Tools.CustomTaskPane = Nothing ctp = CustomTaskPanes.Add(New ucExcel(), "Moin") ctp.Visible = True End Sub
Marcel Gnoth, © Custom TaskPanes Zugriff auf Excel Objekte Globals.ThisApplication Dim s As Excel.Worksheet = _ CType(Globals.ThisApplication.ActiveSheet, _ Excel.Worksheet) s.Cells(3, 6) = "Hallo, Moin: " & Now
Marcel Gnoth, © Stacking und Order Mehrere TaskPanes (AddIn) erscheinen nebeneinander Stellen je ein UserControl dar ActionsPane (Doc) erscheint neben TaskPane (AddIn) ActionsPane (Doc) erscheint nur einmal und stellt mehrere UserControls dar Stacking Order und Layout
Demo ActionsPane
Content Controls & XML Mapping Trennung von XML – Daten und Dokument Content Controls XML Mapping
Marcel Gnoth, © Content Controls Neu in Word 2007 Vordefinierte Platzhalter, die der Anwender ausfüllen soll Verschiedene Typen, wie Textbox, drop-down oder Calender Können XML Daten zugeordnet werden Können gegen löschen gesperrt werden Trennung von Dokument und Formulardaten
Marcel Gnoth, © Content Control Bei MausOver erscheint es Ber MouseExit verschwindet es
Marcel Gnoth, © Content Controls Hinzufügen durch UI (Tab Entwickler Tools)
Marcel Gnoth, © Neue Klassen in Office Listen ContentControls Document Range Selection objects ContentControlEntries wdContentControlComboBox wdContentControlDropDownList
Marcel Gnoth, © Neue Klassen in Office ContentControl wdContentControlDate wdContentControlText wdContentControlRichText wdContentControlBlockPicture wdContentControlComboBox wdContentControlDropDownList wdContentControlBuildingBlockGallery ContentControlEntry XMLMapping
Marcel Gnoth, © Content Control – Code Titel wird dem Anwender als Hilfe angezeigt Über den Titel oder den Index kann ein Content-Control referenziert werden Dim oCC As Word.ContentControl Set oCC = Application.Selection.ContentControls.Add _ (wdContentControlText) oCC.Title = "MyTitle" oCC.SetPlaceholderText,,"Type text here" oCC.LockContentControl = True oCC.LockContents = True ActiveDocument.ContentControls.Item("MyTitle").Delete ActiveDocument.ContentControls.Item(1).Delete Dim oCC As Word.ContentControl Set oCC = Application.Selection.ContentControls.Add _ (wdContentControlText) oCC.Title = "MyTitle" oCC.SetPlaceholderText,,"Type text here" oCC.LockContentControl = True oCC.LockContents = True ActiveDocument.ContentControls.Item("MyTitle").Delete ActiveDocument.ContentControls.Item(1).Delete
Marcel Gnoth, © XML Mapping Trennung der XML-Daten von Dokument- Formatierung und Layout. Data / View Verbindet Dokument mit einer XML Datei Office XML Format speichert Custom XML Daten in Document Parts Dokumente können mehrere Custom Data Stores enthalten
Marcel Gnoth, © XML Mapping XML-Mapping zwischen Content Controls und Custom Data Store Über XPath Definitionen Dokument kann gefüllt werden über eine XML Datei Über das Objekt Modell können Custom DataStores hinzugefügt und zugeordnet werden
Marcel Gnoth, © Weitere neue Klassen in Office 2007 CustomXMLNamespaceManager Zuordnung zwischen Namespaces und Prefixes CustomXMLSchemaCollection Schemata für Custom XML Parts CustomXMLSchema Ein Schema CustomXMLParts Collection der Custom XML Parts Auch DataStore des Dokumentes
Marcel Gnoth, © Weitere neue Klassen in Office 2007 CustomXMLPart Ein Custom XML Part des DataStore CustomXMLNodes Menge der CustomXMLNode-Objekte des aktuellen Dokumentes CustomXMLNode Neue msoXMLDataNodeType Enumeration msoXMLNodeAttribute msoXMLNodeCData msoXMLNodeComment msoXMLNodeDocument msoXMLNodeElement msoXMLNodeProcessingInstruction msoXMLNodeText
Marcel Gnoth, © Custom XML Part hinzufügen Part hinzufügen XML aus Datei laden Jedes Part wird in separater Datei abgelegt Ordern: /customXml/item1.xml Dim oCustomXMLPart As Office.CustomXMLPart Dim strXMLPartName As String strXMLPartName = "c:\myDataStoreFiles\myXMLDataStore.xml" ' First, add a new custom XML part to the document Set oCustomXMLPart = ActiveDocument.CustomXMLParts.Add ' Second, load the XML file into the custom XML part Call oCustomXMLPart.Load(strXMLPartName) Dim oCustomXMLPart As Office.CustomXMLPart Dim strXMLPartName As String strXMLPartName = "c:\myDataStoreFiles\myXMLDataStore.xml" ' First, add a new custom XML part to the document Set oCustomXMLPart = ActiveDocument.CustomXMLParts.Add ' Second, load the XML file into the custom XML part Call oCustomXMLPart.Load(strXMLPartName)
Marcel Gnoth, © XML mit Content Controls verbinden String mit XPath dem ContentControl Object zuweisen SetMapping Methode ' First, create the XPath Dim strXPath As String strXPath = "/s:book/s:AuthorFirstName ' Next, create an instance of a content control to work with Dim oContentControl As Word.ContentControl Set oContentControl = Application.Selection.ContentControls.Add _ (wdContentcontrolComboBox) ' Last, map the data using the XPath oContentControl.XMLMapping.SetMapping strXPath ' First, create the XPath Dim strXPath As String strXPath = "/s:book/s:AuthorFirstName ' Next, create an instance of a content control to work with Dim oContentControl As Word.ContentControl Set oContentControl = Application.Selection.ContentControls.Add _ (wdContentcontrolComboBox) ' Last, map the data using the XPath oContentControl.XMLMapping.SetMapping strXPath
Demo Content Controls
Open XML File Format Office Dokumente als Zip-Archive
Marcel Gnoth, © Office Open XML Format Open Packaging Conventions System.IO.Packaging
Marcel Gnoth, © System.IO.Packaging WinFX /.Net 3 Referenz auf C:\WINDOWS\assembly\GAC_MSIL\WindowsBase\ __31bf3856ad364e35\WindowsBase.dll Imports System.IO.Packaging Private wdPackage As Package Private corePropertiesPart As PackagePart wdPackage = Package.Open( _ docName, FileMode.Open, FileAccess.ReadWrite) corePropertiesPart = wdPackage.GetPart(corePropertiesUri) Imports System.IO.Packaging Private wdPackage As Package Private corePropertiesPart As PackagePart wdPackage = Package.Open( _ docName, FileMode.Open, FileAccess.ReadWrite) corePropertiesPart = wdPackage.GetPart(corePropertiesUri)
Marcel Gnoth, © Ändern / Erstellen der Dokumente Zugriff nur auf das XML in den Zip- Dokumenten Kein Office erforderlich Serververarbeitung
Demo Eigenschaften Eines Dokumentes ändern
Marcel Gnoth, © Alles wird gut Uff...
Marcel Gnoth, © Dokument Inspektoren Nach Fertigstellung des Dokumentes Prüfen auf persönliche Infos Überarbeitet Texte und Kommentare anderes Eigene entwickeln Zum Beispiel Prüfen auf Worte und Redewendungen, die nicht verwendet werden sollen us/library/aa aspxhttp://msdn2.microsoft.com/en- us/library/aa aspx
Marcel Gnoth, © Links What's New for Developers in Word Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats Custom Task Panes: Doc-Level and App-Level What's New for Developers in Word Introducing the Microsoft Office (2007) Open XML File Formats Creating Word 2007 Templates Programmatically