New Capabilities with the Open XML File Format
New Capabilities with the Open XML File Format Visual Studio Tools for Office Mike Ormond Developer and Platform Group, Microsoft Ltd mike. ormond@microsoft. com http: //blogs. msdn. com/mikeormond
Agenda Introduction to the file formats Solution development The document information panel Structured solutions with Word Dynamic documents Server document generation Visual Studio Tools for Office
Introduction to the new Open XML File Formats (OR: What does thing look like anyway? ) OPEN XML FILE FORMATS
Evolution Of File Formats Office 2003 Breakthrough XML Support Word. ML, Spreadsheet. ML Custom-defined schema “Wave 12” Office 2007 Office 2000 New XML Formats XML file format default XML Power. Point format Early Innovation XML document properties Office XP First XML Format Spreadsheet XML Office 97 Existing binary file formats designed in 1994, launched in Office 97
The Role Of XML With Documents Scenario Document Assembly Server-based or user-assisted construction of documents from archived content or database content Content Reuse Much easier to move content between documents, including different document types Content Tagging Add domain-specific metadata to document content to enable custom solutions Document Interrogation Query document repositories based on custom data, content types or document metadata Example Create sales reports from financial and forecast data stored in a CRM system Apply content stored in Word documents to Web pages quickly and efficiently Tag presentations using a specific taxonomy to improve knowledge management efficiency Search for all documents containing a specific company name or sales contact Document Sanitization Remove unwanted content like comments or embedded code from your document when appropriate Remove all tracked changes and comments from a Word document before it is published
Default file format More efficient storage Program against full document contents Backward compatibility & legacy support Easy document assembly, conversion & integration Submitted to ECMA for standardization
Open XML Formats Architecture User view: single Office “file” Questionnaire. docx File Container Developer view: modular file Document Properties Comments Document Parts Most parts are XML Each XML part is a discreet, compressed component Can add, extract and modify individual parts without using Office programs Corruption or absence of any part would not prohibit the file from being opened Word. ML / Spreadsheet. ML etc Custom XML Images, video, sound Embedded code / macros Charts
Open XML File Formats
Solution development with the new Open XML File Formats (OR: Great. Now do I make use of this from code? ) SOLUTION DEVELOPMENT
Tools for Accessing Data In Office Open XML files XML Editing Notepad? System. XML makes this easier ZIP Manipulation Compressed Folders in Windows? Third-Party Zip Libraries Microsoft’s Packaging API’s Office Open XML Resource Kit Code Snippets - Beta 2 C# and VB. NET Validation Library Parses a file and reports on schema, relationship errors and warnings Serialization/Deserialization Library Flattens package into a single file for ease of development in simple construction scenarios
System. IO. Packaging Part of. NET Fx 3. 0 Allows you to Create / Open packages Create and delete parts and relationships Read and write part streams Iterate through collections of parts and relationships Package. Part. Collection └ Package. Part Package. Relationship. Collection └ Package. Relationship Pack. Uri. Helper
System. IO. Packaging. Package Digital Signatures Specific Format Parts office. Document XML Part P a rt R e l s Package Relationships Package. Properties Parts Thumbnail Package Relationships Package class provides methods to create, enumerate and delete the following entities Common Package Parts Core Properties Etc… XML Part
System. IO. Packaging. Relationship Digital Signatures Specific Format Parts office. Document XML XML Part P a rt R e l s ID Package Relationship. Type Source. Uri Target. Mode Target. Uri Thumbnail Package Relationships tie the parts together Required to find parts (part names are not guaranteed) Iterate through Relationship. Collection by Type or ID Relationship Properties Common Package Parts Core Properties Etc… XML Part
System. IO. Packaging. Package. Part Digital Signatures Specific Format Parts office. Document XML Part P a rt R e l s -- <w: r> <w: t>The Cow Quick jumped Brownover Fox the jumped over moon. </w: t> the river. </w: t> </w: r> </w: p>… Thumbnail Package Relationships Parts are the objects of data within the Package. Part provides support to create, enumerate and delete part relationships Get Part data as Stream Package. Part Properties: Compression. Option Content. Type Package <w: body> - <w: p w: rsid. R="001 B 7 EF 4" Uri w: rsid. RDefault="001 B 7 EF 4"> Common Package Parts Core Properties Etc… XML Part
Document Interrogation Scenarios When you need meta-data about Office files on a server Building reports from data in files Workflow and Content Management scenarios Validate compliance
Document Assembly Scenarios Useful when documents need to be generated from structured data Auto generate reports in Excel from data in database Create documents for users from form data Repurpose existing data (slide libraries) Recommendation: Start from a template
Document Sanitization Scenarios Security Remove active content (VBA, Active. X) Privacy Remove comments, revisions, hidden text Remove or alter document properties Legal Insert copyrights, watermarks, images Run as part of Workflows, publishing, compliance scenarios
Solution Development
Creating smart forms and dynamic documents (OR: How to leverage the power of Info. Path in your documents. You do know what Info. Path is don’t you? ) THE DOCUMENT INFORMATION PANEL
Document Information Panel Customisable form displayed in the client application Allows users to enter document properties (metadata) while working on the document Share. Point properties appear as metadata in the DIP
Custom Information Panel The Document Information Panel uses Info. Path technology This technology can be used to create business logic around any custom XML data All the power of Info. Path in Word Data connections, declarative rules engine, etc.
Document Info Panel
Structured solution authoring with Word 2007 – Rich UI and robust editing behaviour. (OR: How to author multi-use and dynamic documents to make everyone’s life easier) EXERCISING CONTROL
The Role Of XML Reference and custom-defined schemas XML Reference Schemas Display-oriented (e. g. Bold, Italics, Tables, Paragraphs, Styles) Open Document Format Enable Archival & File Formats Interoperability Custom-defined Schemas Data-oriented (e. g. , Price, Invoice) Represents the business information stored in the document Enable System Integration
The Role Of XML Reference and custom-defined schemas XML Reference Schemas Display-oriented (e. g. Bold, Italics, Tables, Paragraphs, Styles) Open Document Format Enable Archival & File Formats Interoperability <w: p> <w: r. Pr><w: b /></w: r. Pr> <w: t>John Doe</w: t> </w: r> <w: r. Pr><w: i /></w: r. Pr> <w: t>Health Agency</w: t> </w: r> </w: p>
The Role Of XML Reference and custom-defined schemas <Conference. Report> <Date>3/24/2004</Date> <Attendees> <Attendee Name=“John Doe”> <Department> Health Agency </Department> <Potential> <Sales>100</Sales> <Growth>25%</Growth> … </Attendee> Custom-defined Schemas Data-oriented (e. g. , Price, Invoice) Represents the business information stored in the document Enable System Integration
Content Controls (Word) Makes structured documents more robust & much less Word specific code needed Content restrictions, grouping & locking Code can be used for business logic! End user friendly and layout independent exposure of structured content No XML schema required Evolution of customer-defined XML with custom XML mapping capabilities (more detail in CD 305)
Solutions And Building Blocks Select and reuse any selection of Wordprocessing. ML Building blocks and content controls Two steps to a document assembly solution Write 18 lines of UI code Make a few selections and clicks or attach a building block part
Content Controls
Content Controls + Custom XML Store = Rich, Robust, Dynamic documents MAKING DOCUMENTS WORK FOR YOU
Office XML Data Store Customer-defined XML (incl. WSS/Office properties) stored separately from Wordprocessing. ML as a part in Open XML format Any XML can be stored (with or without XML schema) XML data is available as an editable tree (using familiar DOM) within Word Can be populated on a server using Win. FX or a client using Word OM
XML Mapping Link content controls to nodes in the XML data store Provides for true data/view separation model in Word Mappings are created using standard XPath expressions Mappings can be set up to ‘auto-attach’ to incoming data Out of the box support for mapping to Office properties
Content Controls + Custom XML <Attendees> <Attendee Name=“John Doe”> <Department> Health Agency </Department> <Potential> <Sales>100</Sales > … </Attendee>
Dynamic Documents
Generating Office Documents on the Server WHAT ABOUT THE SERVER
Putting it all together Start with a Template Document Assembly System. IO. Packaging Delete / Create Parts & Relationships Document Manipulation System. IO. Packaging Word -> Content Controls + Custom XML Excel -> System. Xml + Spreadsheet. ML Power. Point -> System. Xml + Presentation. ML
Document Assembly On the Server
VISUAL STUDIO TOOLS FOR OFFICE
Visual Studio Tools For Office Tool for building managed applications targeting Office 2003 / Office 2007 The managed code API for Office Generates a lot of the “plumbing” code Visual designers Separate date & presentation Robust run-time Flavours VSTO 2005, VSTO 2005 SE, VSTO V 3 (Orcas). . .
VSTO Editions From Wouter van Vugt (http: //blogs. infosupport. com/wouterv) VSTO Version 2003 2005 Office 2003 doc app Additional Information Excel Info. Path Word Visual Studio. NET 2003 Excel Info. Path Outlook Word Data Caching Server-Side Programming Integrated Designer Smart Tags Actions. Pane 2005 SE "V 3" app Office 2007 Excel Word Excel Info. Path Outlook Rbbon Customization Outlook Custom Task. Panes Power. P Info. Path Power. P oint Outlook Form Regions oint Visio Compatibility Visio Word Ribbon Customization Custom Task. Panes Excel Outlook Form Regions Info. Path All New Security Model Word Click. Once Deployment App. Domain Isolation Runtime Standardization
Visual Studio Tools for Office
Additional Resources Open XML File Formats http: //www. openxmldeveloper. ordg http: //blogs. msdn. com/brian_jones General http: //msdn. microsoft. com/office http: //blogs. msdn. com/dmahugh http: //blogs. msdn. com/erikaehrli VSTO / Programmability http: //msdn. microsoft. com/office/tool/vsto http: //www. officezealot. com/vsto http: //blogs. msdn. com/kevinboske http: //blogs. msdn. com/eric_carter
Additional Information UK MSDN Events Post events page including slide decks http: //www. microsoft. com/uk/msdnevents Upcoming events http: //www. microsoft. com/uk/msdn/events/upcoming. aspx UK MSDN Site & Flash Newsletter Local news, events, nuggets & webcasts http: //www. microsoft. com/uk/msdn Register to receive the bi-weekly MSDN Flash by email http: //www. microsoft. com/uk/msdn/flash. aspx
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
- Slides: 44