OFC335Microsoft Office Word 2007 XML Programmability: True Data/View Separation and Rich Eventing for Custom XML Tristan DavisProgram ManagerMicrosoft Corporation
Agenda The world today (Microsoft Office Word 2003)Structural IntegrityContent ControlsData/View SeparationMicrosoft Office XML data storeXML mappingConclusionQuestions
The World Today Word 2003 was a major step forward:XML-based file format (WordprocessingML)Customer-defined schema supportHowever, a big toolbox doesn’t mean it’s easy to build a houseYou need XML schema, XSLT, client-side code, etc.
The World of Word 2007 Make it easier to push/pull customer data within Word documentsHow?Structural integrity (Content Controls)Provide content restriction, lockdown capabilityData/view separation (Office XML data store)Place to store custom XML data in the new file formatEach item is stored as a separate part within the package
Tristan DavisProgram ManagerMicrosoft Word
Content Controls Evolution of customer-defined XMLNo XML schema requiredProvide friendly end user exposure of structured contentEach provides unique content restrictions / user interface that doesn’t affect layoutControls can be grouped to lock them down as a unitControls can be mapped to XML data
XML Data Store / XML Mapping Tristan DavisProgram ManagerMicrosoft Word
Office XML Data Store Customer-defined XML (incl. WSS/Office doc props) stored separately from WordprocessingML as a part in Open XML formatAny XML can be stored (with or without XML schema)XML data is available as an editable tree (using familiar DOM) within WordCan be populated on a server using WinFX or a client using Word OM
XML Mapping Link document controls to nodes in the XML data storeProvides for true data/view separation model in WordMappings are created using standard XPath expressionsMappings can be set up to ‘auto-attach’ to incoming dataOut-of-the-box support for mapping to Office properties
Mapping WSS Data Into Word Tristan DavisProgram ManagerMicrosoft Word
Mapping WSS Data into Word Word 2007 has native integration between the WSS property set and the XML mapping architecture:WSS properties are stored as items in the Office XML data storeProperties can be mapped to content controls in the documentWSS docs automatically get UI on the ribbon to do this mappingInfoPath property panel is synchronized with the data store
Client Side Programming Recommended approach: program directly against the dataInfoPath or Office OM – your choiceWord will automatically take care of the effects on the presentation via the XML mappingsUse shared error board to communicate validation errors to the userUse controls OM if you need behavior for specific controls (e.g. to block user from exiting)
Using InfoPath for Client-Side Business Logic Tristan DavisProgram ManagerMicrosoft Word
Using Office OM for Client-Side Business Logic Tristan DavisProgram ManagerMicrosoft Word
Server Side Programming Recommended approach: Using WinFX to navigate the file formatAdding a part is as simple as adding a single relationshipFinding an existing part is done by namespace or GUID matching
Using Custom XML Data on the Server Tristan DavisProgram ManagerMicrosoft Word
Related Areas In VSTO V3 Document control support in the Microsoft Visual Studio designerIntegration with .NET data binding.NET programming model for the XML data store for document manipulation on client/serverLeveraging the XML data store / new file format for VSTO solution storage
Conclusion Two main themes to Word 2007 for solution creationMake structured document more robust by providing controls and content groupsProvide true data/view separation by providing custom XML data storeResult: you have to write less code and your solutions are more reliable with Word as the editing environment
Key Takeaways Word 2007 allows for more granular control over structured data via content controlsSpecialized UI, Content restrictions, locking, etc.Word 2007 allows for separation of data and presentation via the Office XML data storeWord 2007 allows for automatic two-way synchronization between data and view via XML mapping
Resources
The 2007 Microsoft Office System Clients. Servers. Solutions. Install Beta 2 today! It’s in your attendee bagLearn more at the Office System TLCDemo Stations / Hands-on-Labs / Chalk-talksGet more informationhttp://www.microsoft.com/office/preview/default.mspxhttp://msdn.microsoft.com/office/
Fill out a session evaluation on CommNet and Win an XBOX 360!