Presentation is loading. Please wait.

Presentation is loading. Please wait.

Office Open XML Developer Workshop Custom XML Integrating data and documents.

Similar presentations


Presentation on theme: "Office Open XML Developer Workshop Custom XML Integrating data and documents."— Presentation transcript:

1 Office Open XML Developer Workshop Custom XML Integrating data and documents

2 Office Open XML Developer Workshop Disclaimer The information contained in this slide deck represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This slide deck is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this slide deck may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this slide deck. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this slide deck does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred. © 2006 Microsoft Corporation. All rights reserved. Microsoft, 2007 Microsoft Office System,.NET Framework 3.0, Visual Studio, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

3 Office Open XML Developer Workshop Why Custom XML? Enables interoperability with other systems Documents can provide a rich view of back-end data sources Documents can update back-end data sources Exposes business data in Open XML documents Heterogenous systems can easily read data from documents Business-specific semantics can be applied to document data Separates presentation and data Simplified programming model for all of the above Custom XML schema support was a key design objective for Open XML: any schema can be used in Open XML documents.

4 Office Open XML Developer Workshop Custom XML: Developer Options TechnologyWMLSMLPML Custom XML Parts Format-agnostic, very clean (only your tags) May be non-visible YES Structured Document Tags (Content Controls) Bound to custom XML parts or metadata YES CustomXML Markup Tag block-level content with custom schema Also available in Word 2003 YES Custom XML Mapping WordprocessingML: map content controls to custom Xml parts SpreadsheetML: map cells to nodes in an external XML file YES Smart Tags Simple, familiar, was available in Word 2003 YES

5 Office Open XML Developer Workshop CUSTOM XML PARTS

6 Office Open XML Developer Workshop Custom XML Parts Pure custom data: only your tags appear in the part Format-agnostic WordprocessingML: relationship from main document SpreadsheetML: relationship from workbook PresentationML: relationship from presentation or slide Explicit relationship from a shape on a slide No content restrictions: any schema (or none), any number of parts Syntactical restriction: must contain well-formed XML

7 Office Open XML Developer Workshop Custom XML Part: Properties/Metadata Information about a custom XML part is stored in a custom XML properties part Stored via an implicit customXmlProps relationship from the custom XML part Contains two types of information: Part ID Uniquely identifies a part within a document Maintained through editing sessions Office uses GUIDs, you can use any type of unique identifier XML Schema references DEMO

8 Office Open XML Developer Workshop STRUCTURED DOCUMENT TAGS

9 Office Open XML Developer Workshop Structured Document Tags Smart tags and custom XML markup add semantics, but do not have any effect on presentation Sometimes you want to affect presentation Custom UI behaviors: data-entry restrictions, multi-select, etc. The solution: the structured document tag

10 Office Open XML Developer Workshop Structured Document Tags A structured document tag has two sections: SDT properties SDT content

11 Office Open XML Developer Workshop Structured Document Tag Properties Generic properties: Type, Title, ID, placholder text Type-specific properties Example: values for populating a dropdown list Runtime behaviors (locking properties) Whether region is editable Whether region is deletable

12 Office Open XML Developer Workshop Other Control Types In addition to plain text: Rich Text Date Picker Picture Combobox Dropdown List Document Building Block

13 Office Open XML Developer Workshop DATA BINDING

14 Office Open XML Developer Workshop Data Binding: Bringing It All Together 2-way synchronization between: Content controls (data in structured document tags) Custom XML nodes (data in your schema)

15 Office Open XML Developer Workshop Data Binding Syntax element inside

16 Office Open XML Developer Workshop Data Binding Basics To bind a custom Xml node to a structured document tag: Add a element to the structured document tag properties specifices a custom Xml part (by Custom XML Data Identifier) and an Xpath to a specific node within that part Custom XML Data Identifier? What’s that? The custom XML part has a properties part Implicit relationship in customXmlPart.xml.rels The properties part specifies a Custom XML Data Identifier DEMO

17 Office Open XML Developer Workshop Content Control Toolkit Open-source developer tool http://www.codeplex.com/Wiki/View. aspx?ProjectName=dbe Automatically generates parts, relationships, and markup to bind custom XML parts to content controls Use to create data-bound documents with no programming Use as a learning tool, to generate markup for use in custom solutions DEMO

18 Office Open XML Developer Workshop CUSTOM XML MARKUP

19 Office Open XML Developer Workshop Custom XML Markup Basics Allows embedding the structure from any XML schema into a WordprocessingML document You don’t have to have a schema Your XML doesn’t have to validate against your schema Custom XML elements may have custom attributes Whatever is required within your schema Open XML consumers/producers preserve your attributes

20 Office Open XML Developer Workshop Where can Custom Xml Markup appear? Custom XML markup can appear at two levels Block level (around and/or sibling to paragraphs) Inline (around and/or sibling to runs) Custom XML markup may be nested Complex multi-level data semantics may be used

21 Office Open XML Developer Workshop Custom XML Markup Example DEMO

22 Office Open XML Developer Workshop Custom XML Markup: Why ? Why not just embed the custom XML directly in the WordprocessingML document? Answer: this way, your custom schema doesn’t need to support WordprocessingML within it This abstraction provides the flexibility to support any schema in custom XML markup

23 Office Open XML Developer Workshop CUSTOM XML MAPPING

24 Office Open XML Developer Workshop XML Mapping Overview Your custom schema / XML added to a workbook XML elements & attributes ‘mapped’ to cells & Tables Store a copy of the schema in the workbook Top level map object Custom properties on each cell or column

25 Office Open XML Developer Workshop Example

26 Office Open XML Developer Workshop How It All Ties Together Map Object Table1 Schema Cell 1 Table 2 Cell 2 SchemaId mapId

27 Office Open XML Developer Workshop Custom XML Source A cache of the user schemas added to the workbook (xmlmaps.xml) Nodes mapped to tables (table1.xml) Nodes mapped to single cells (tableSingleCells1.xml)

28 Office Open XML Developer Workshop xmlMaps.xml … … … …

29 Office Open XML Developer Workshop Table1.xml

30 Office Open XML Developer Workshop tableSingleCells.xml

31 Office Open XML Developer Workshop Custom XML Mapping Example Save this XML to a file on your desktop: Brian Jones (425) 123-4567 Chad Rothschiller (425) 123-4567

32 Office Open XML Developer Workshop Custom XML Mapping Example Map the Schema –Open a blank Excel spreadsheet. –On the Data ribbon choose From Other Sources / From XML Data Import. –Find the XML file you just saved and double-click it. Import your Data –Following the prompts to map to the SML schema and import the data to the worksheet. Export the Results Right-click the list under the XML flyout and choose Export…

33 Office Open XML Developer Workshop SMART TAGS

34 Office Open XML Developer Workshop Smart Tags Semantics may be added to a run or set of runs Provides information about the type of information May have application-specific implementation (e.g., purple underline) Semantics are application-independent

35 Office Open XML Developer Workshop Smart Tag Property Bag You may want to store additional properties for your smart-tag element These can be added to Any number of custom namespace/element/value settings Once embedded, consumers can ignore the semantics without affecting the presentation of the document Producers must preserve the semantic information Optionally, a producer may use smart tag data to provide context-sensitive functionality

36 Office Open XML Developer Workshop Converting Office 2003 smart-tag syntax In Office 2003, smart tags used this syntax: Name: Brian In Office Open XML, it works like this: Name: Brian

37 Office Open XML Developer Workshop


Download ppt "Office Open XML Developer Workshop Custom XML Integrating data and documents."

Similar presentations


Ads by Google