Zeyad RajabiProgram ManagerMicrosoft Corporation
Open XML Format SDK: Developing Open XML Solutions
PC34
Agenda
Open XML formats Manipulating Office files Open XML SDK overview Open XML SDK architecture plus roadmap Lots of demos Open XML SDK tools Resources plus links Questions and answers
Open XML Formats
What Are They?
Open XML Formats Architecture
User’s see a single file
MyDoc.docx
Developer’s see a zip file with xml parts
Document properties
File container
Comments
WordML/SpreadsheetML, etc.
Custom-defined XML
Images, video, sound
Styles
Charts
Default format in Office 2007 Word (.docx) Excel (.xlsx) PowerPoint (.pptx)
Open XML is an ISO standard
Document parts Most parts are XML
Open XML Formats
Zeyad RajabiProgram ManagerOffice
demo
Office Open XML Formats
Allows developers access to Office files without the need of the Office applications
Current toolset for Open XML WinZip, MSXML, and Notepad System.IO.Packaging, System.XML, and LINQ
Future of Open XML development Open XML SDK
Manipulating Office Files
Old School Versus New School
Old School WaysAutomating Office Applications
Zeyad RajabiProgram Manager Office
demo
Key Takeaways
Application Object Model was not designed for server scenarios
Too much power for document related solutions
Does not scale Try running automation on 100s of documents
Dialog boxes “stop” automation Customers reboot application on server
every X hours
New School Leveraging The Open XML SDK
Zeyad RajabiProgram ManagerOffice
demo
Key Takeaways
Open XML SDK allows access to document content
Fast (… really fast) Works on client and server environments
Including SharePoint No need for Office to manipulate files We will show code to this demo a little later
Open XML SDK
What It Is And What It’s Not?
Allows you to create and modify Open XML documents SDK currently supports ECMA 376
Based on .NET (C# and VB) Compatible with LINQ
Provides a unified platform for solutions Consistent client and server solutions
This SDK does NOT Replace Office application Object Models Perform layout plus recalculation tasks Perform file conversions to other formats, like PDF or XPS
The SDK will be released in two versions Version 1: Part level manipulation Version 2: Content level manipulation
Open XML SDK Overview
Version 1.0 of the SDK Final bits released June 2008 “Go-Live” license
Free to use and build/deploy solutions Version 2.0 of the SDK
1st CTP released September 2008 More CTPs to come Final release around same time Office 14 ships
Open XML SDK Road Map
Open XML SDK Architecture
System Support
.Net 3.5 System.IO.Packaging Open XML Schemas
Open XML File Format Base Level
Reading/Writing Low Level DOM Packaging API
Open XML File Format Higher Level
Schema Level Validation
Semantic Level Validation
Helper Functions
Base level is the foundation of the SDK Provides strongly typed access to:
Parts within an Open XML Format XML contained within a part
Provides DOM-like and SAX-like reading and writing capability
Open XML SDK Base Level
System Support
.Net 3.5 System.IO.Packaging Open XML Schemas
Open XML File Format Base Level
Reading/Writing Low Level DOM Packaging API
Open XML File Format Higher Level
Schema Level Validation
Semantic Level Validation
Helper Functions
Open XML SDK Higher Level
Current thinking is future CTPs for version 2.0 will have validation functionality
Validate: Against Open XML schemas Against set of semantic constraints defined in
standard Helper functions – code snippets
System Support
.Net 3.5 System.IO.Packaging Open XML Schemas
Open XML File Format Base Level
Reading/Writing Low Level DOM Packaging API
Open XML File Format Higher Level
Schema Level Validation
Semantic Level Validation
Helper Functions
New School Creating The Code
Zeyad RajabiProgram ManagerOffice
demo
Key Takeaways
Easy to search for specific content Easy to manipulate and add content to
existing documents Intellisense really helps Again, fast
Document AssemblyAutomated Reporting In PresentationML Zeyad Rajabi
Program ManagerOffice
demo
Key Takeaways
Fast Starting from a template is always easiest Easy to clone parts or objects with SDK LINQ built into SDK makes it really easy to
query and update content Can either use strongly typed
objects or xml directly
Document AssemblyCreating A Spreadsheet And Chart From Database Zeyad Rajabi
Program ManagerOffice
demo
Key Takeaways
Again, starting from a template is always easier than creating from scratch
Make your file look good using Office application then use as template
Easy to add/modify content with SDK
Document AssemblyMerging Documents Together
Zeyad RajabiProgram ManagerOffice
demo
Key Takeaways
AltChunks is the easy way to merge documents within WordprocessingML Can merge other Word documents
or even html Allows for structured search
Search for content controls or custom xml Allows for extraction and insertion of
content or documents Ensures consistent style of inserted content Solution easily integrated in SharePoint
Open XML SDK Tools
Use The Tools!
SDK provides the following tools1. Open XML Diff 2. Class Explorer3. Document Reflector
Open XML Diff Compare differences in two Open XML files
Class Explorer Allows developers to navigate Open XML standard as
it relates to the SDK Document Reflector
Automatically generates Open XML SDK code based on document
Open XML SDK Tools
Open XML Power Tools
A set of 30+ cmdlets that create and modify Open XML documents Removing comments, accepting tracked
revisions, etc. Supports the PowerShell piping architecture
Documents are piped from cmdlet to cmdlet as objects
Built on Open XML SDK Available on CodePlex
http://www.codeplex.com
Open XML Power Tools
Zeyad RajabiProgram ManagerOffice
demo
Key Takeaways
IT and developers can perform batch scripts using PowerTools
Released as open source, under the Microsoft Public License (Ms-PL)
Works with PowerShell Provides a set of rich functionalities to build
and modify rich Open XML Formats
VSTO Power Tools
Open and edit Open XML documents directly in Visual Studio http://www.microsoft.com/downloads/details.
aspx?FamilyID=46B6BF86-E35D-4870-B214-4D7B72B02BF9
Demos…We Have More…
Come by the Office client booth to see more demos
Bring a USB key to copy source code of demos
Download demos at Eric White’s blog
Links Plus Resources
Blogs Eric White’s blog: http://blogs.msdn.com/ericwhite Doug Mahugh’s blog: http://blogs.msdn.com/dmahugh Brian Jones’ blog: http://blogs.msdn.com/brian_jones
MSDN Contains how-to articles and documentation Forums related to SDK http://msdn.microsoft.com/office/xml
Connect Access to more articles and forums Ability to log bugs and vote for features http://connect.microsoft.com
Codeplex Open source projects related to Open XML solutions http://www.codeplex.com
Download site for the SDK: Version 1.0: http://go.microsoft.com/fwlink/?LinkId=120908 Version 2.0: http://go.microsoft.com/fwlink/?LinkId=127912
Q&AAny
Questions?
Evals & Recordings
Please fill
out your
evaluation for
this session at:
This session will be available as a recording at:
www.microsoftpdc.com
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. 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 provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.