Top Banner
Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12
36

Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Apr 06, 2015

Download

Documents

Ilsa Bodden
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Visual Studio Tools für Office 2007

Next Generation Applications for Office - Teil 2

Marcel Gnoth, Avanade Deutschland GmbH

CS3, VB7, OF2, PA12

Page 2: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

2

Marcel Gnoth, www.gnoth.net , © 2006

Zur Person• Dipl. Inf. Marcel Gnoth, MCSD

• Senior Consultant, Avanade Deutschland GmbH• Office Business Application Group & Business Intelligence• [email protected] , www.gnoth.net (Code+Folien)

• 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

Page 3: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

3

Marcel Gnoth, www.gnoth.net , © 2006

Ü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 4.000 Mitarbeitern in 21 Ländern• Unternehmenslösungen auf Basis von

Microsoft-Technologien• über 3.000 Projekte bei rund 1.900 Kunden

weltweit

Page 4: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

5

Marcel Gnoth, www.gnoth.net , © 2006

Globale Präsenz• Avanade wächst stetig und zählt im Februar 2006 mehr als 4.000

Mitarbeiter in 21 Ländern, sowie über 3.000 Projekte bei rund 1.900 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

Page 5: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

7

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 6: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

8

Marcel Gnoth, www.gnoth.net , © 2006

VSTO – Zwischenrelease• Office 2007 + Visual Studio 2005

• VSTO 2005 Cypress • Visual Studio 2005 Tools for Office

Second Edition (VSTO 2005 SE)• http://msdn.microsoft.com/office/tool/vsto/

2005SE/default.aspx

• Beta

• Office 2007 + VSTO V3 • Nächste Visual Studio Version (Orcas)

Page 7: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Task Panes & Actions Panes

Applikationsbezogenes UI

Page 8: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

10

Marcel Gnoth, www.gnoth.net , © 2006

Taskpanes• Windows Froms Userinterface• Integriert in Office• Office 2003:

• Auf Dokumentebene• Dokument Aktionen

• Office 2007• Auch auf Applikationsebene• Aufgabenbereich

Page 9: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

11

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 10: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

12

Marcel Gnoth, www.gnoth.net , © 2006

Custom TaskPanes• Neues ICustomTaskPaneConsumer

Interface• Neues Projekt: AddIn

Page 11: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

13

Marcel Gnoth, www.gnoth.net , © 2006

Custom TaskPanes• Dll Projekt• UserControl hinzufügen• Excel startet beim Debuggen• Neue Taskpane mit UserControl

erstellenPrivate Sub ThisApplication_Startup(…) Handles Me.Startup Dim ctp As Microsoft.Office.Tools.CustomTaskPane = Nothing ctp = CustomTaskPanes.Add(New ucExcel(), "Moin") ctp.Visible = TrueEnd Sub

Page 12: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

14

Marcel Gnoth, www.gnoth.net , © 2006

Custom TaskPanes• Zugriff auf Excel Objekte

• Globals.ThisApplicationDim s As Excel.Worksheet = _ CType(Globals.ThisApplication.ActiveSheet, _ Excel.Worksheet)s.Cells(3, 6) = "Hallo, Moin: " & Now

Page 13: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

15

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 14: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Demo

ActionsPane

Page 15: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Content Controls & XML Mapping

Trennung von XML – Daten und DokumentContent Controls

XML Mapping

Page 16: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

18

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 17: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

19

Marcel Gnoth, www.gnoth.net , © 2006

Content Control• Bei MausOver erscheint es • Ber MouseExit verschwindet es

Page 18: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

20

Marcel Gnoth, www.gnoth.net , © 2006

Content Controls• Hinzufügen durch UI (Tab Entwickler

Tools)

Page 19: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

21

Marcel Gnoth, www.gnoth.net , © 2006

Neue Klassen in Office• Listen

• ContentControls• Document• Range• Selection objects

• ContentControlEntries• wdContentControlComboBox• wdContentControlDropDownList

Page 20: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

22

Marcel Gnoth, www.gnoth.net , © 2006

Neue Klassen in Office• ContentControl

• wdContentControlDate • wdContentControlText • wdContentControlRichText• wdContentControlBlockPicture• wdContentControlComboBox• wdContentControlDropDownList• wdContentControlBuildingBlockGallery

• ContentControlEntry• XMLMapping

Page 21: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

23

Marcel Gnoth, www.gnoth.net , © 2006

Content Control – Code• Titel wird dem Anwender als Hilfe

angezeigt• Über den Titel oder den Index kann ein

Content-Control referenziert werdenDim oCC As Word.ContentControlSet oCC = Application.Selection.ContentControls.Add _

(wdContentControlText)oCC.Title = "MyTitle"oCC.SetPlaceholderText ,,"Type text here"oCC.LockContentControl = TrueoCC.LockContents = True

ActiveDocument.ContentControls.Item("MyTitle").DeleteActiveDocument.ContentControls.Item(1).Delete

Dim oCC As Word.ContentControlSet oCC = Application.Selection.ContentControls.Add _

(wdContentControlText)oCC.Title = "MyTitle"oCC.SetPlaceholderText ,,"Type text here"oCC.LockContentControl = TrueoCC.LockContents = True

ActiveDocument.ContentControls.Item("MyTitle").DeleteActiveDocument.ContentControls.Item(1).Delete

Page 22: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

24

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 23: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

25

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 24: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

26

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 25: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

27

Marcel Gnoth, www.gnoth.net , © 2006

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

Page 26: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

28

Marcel Gnoth, www.gnoth.net , © 2006

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.CustomXMLPartDim strXMLPartName As StringstrXMLPartName = "c:\myDataStoreFiles\myXMLDataStore.xml"

' First, add a new custom XML part to the documentSet oCustomXMLPart = ActiveDocument.CustomXMLParts.Add

' Second, load the XML file into the custom XML partCall oCustomXMLPart.Load(strXMLPartName)

Dim oCustomXMLPart As Office.CustomXMLPartDim strXMLPartName As StringstrXMLPartName = "c:\myDataStoreFiles\myXMLDataStore.xml"

' First, add a new custom XML part to the documentSet oCustomXMLPart = ActiveDocument.CustomXMLParts.Add

' Second, load the XML file into the custom XML partCall oCustomXMLPart.Load(strXMLPartName)

Page 27: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

29

Marcel Gnoth, www.gnoth.net , © 2006

XML mit Content Controls verbinden

• String mit XPath dem ContentControl Object zuweisen• SetMapping Methode

' First, create the XPathDim strXPath As StringstrXPath = "/s:book/s:AuthorFirstName„

' Next, create an instance of a content control to work withDim oContentControl As Word.ContentControlSet oContentControl = Application.Selection.ContentControls.Add _ (wdContentcontrolComboBox)' Last, map the data using the XPathoContentControl.XMLMapping.SetMapping strXPath

' First, create the XPathDim strXPath As StringstrXPath = "/s:book/s:AuthorFirstName„

' Next, create an instance of a content control to work withDim oContentControl As Word.ContentControlSet oContentControl = Application.Selection.ContentControls.Add _ (wdContentcontrolComboBox)' Last, map the data using the XPathoContentControl.XMLMapping.SetMapping strXPath

Page 28: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Demo

Content Controls

Page 29: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Open XML File Format

Office Dokumente als Zip-Archive

Page 30: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

32

Marcel Gnoth, www.gnoth.net , © 2006

Office Open XML Format• Open Packaging Conventions • System.IO.Packaging

Page 31: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

33

Marcel Gnoth, www.gnoth.net , © 2006

System.IO.Packaging• WinFX / .Net 3• Referenz auf

• C:\WINDOWS\assembly\GAC_MSIL\WindowsBase\3.0.51116.0__31bf3856ad364e35\WindowsBase.dll

Imports System.IO.PackagingPrivate wdPackage As PackagePrivate corePropertiesPart As PackagePart

wdPackage = Package.Open( _ docName, FileMode.Open, FileAccess.ReadWrite)corePropertiesPart = wdPackage.GetPart(corePropertiesUri)

Imports System.IO.PackagingPrivate wdPackage As PackagePrivate corePropertiesPart As PackagePart

wdPackage = Package.Open( _ docName, FileMode.Open, FileAccess.ReadWrite)corePropertiesPart = wdPackage.GetPart(corePropertiesUri)

Page 32: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

34

Marcel Gnoth, www.gnoth.net , © 2006

Ändern / Erstellen der Dokumente• Zugriff nur auf das XML in den Zip-

Dokumenten• Kein Office erforderlich• Serververarbeitung

Page 33: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

Demo

Eigenschaften Eines Dokumentes ändern

Page 34: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

36

Marcel Gnoth, www.gnoth.net , © 2006

Alles wird gut

Uff...Uff...

Page 35: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

37

Marcel Gnoth, www.gnoth.net , © 2006

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

• http://msdn2.microsoft.com/en-us/library/aa338203.aspx

Page 36: Visual Studio Tools für Office 2007 Next Generation Applications for Office - Teil 2 Marcel Gnoth, Avanade Deutschland GmbH CS3, VB7, OF2, PA12.

38

Marcel Gnoth, www.gnoth.net , © 2006

Links• What's New for Developers in Word 2007

• http://msdn2.microsoft.com/en-us/library/ms406055.aspx

• Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats • http://www.microsoft.com/office/preview/beta/converter.mspx

• Custom Task Panes: Doc-Level and App-Level • http://blogs.msdn.com/andreww/archive/

2006/07/31/684595.aspx • What's New for Developers in Word 2007

• http://msdn2.microsoft.com/en-us/library/ms406055.aspx • Introducing the Microsoft Office (2007) Open XML File Formats

• http://msdn2.microsoft.com/en-us/library/aa338205.aspx • http://msdn2.microsoft.com/en-us/library/ms771890.aspx

• Creating Word 2007 Templates Programmatically • http://msdn2.microsoft.com/en-us/library/ms406053.aspx