new capabilities with the open xml file format visual studio tools for office mike ormond developer...
TRANSCRIPT
New Capabilities with the New Capabilities with the Open XML File FormatOpen XML File FormatVisual Studio Tools for OfficeVisual Studio Tools for Office
Mike OrmondDeveloper and Platform Group, Microsoft [email protected]://blogs.msdn.com/mikeormond
AgendaAgenda
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
OPEN XML FILE FORMATSOPEN XML FILE FORMATS
Introduction to the new Open XML File Formats
(OR: What does this thing look like anyway?)
Evolution Of File FormatsEvolution Of File Formats
Office 2000Office 2000Early InnovationEarly Innovation
XML document XML document propertiesproperties
Office 97Office 97Existing binary file formats Existing binary file formats designed in 1994, launched designed in 1994, launched in Office 97in Office 97
Office XPOffice XPFirst XML First XML FormatFormat
Spreadsheet Spreadsheet XMLXML
Office 2003Office 2003Breakthrough XML Breakthrough XML SupportSupport
WordML, SpreadsheetMLWordML, SpreadsheetML
Custom-defined schemaCustom-defined schema
Office 2007Office 2007New XML FormatsNew XML Formats
XML file format defaultXML file format default
XML PowerPoint formatXML PowerPoint format
““Wave 12”Wave 12”
The Role Of XML With The Role Of XML With DocumentsDocumentsScenarioScenario ExampleExampleDocument AssemblyDocument AssemblyServer-based or user-assisted Server-based or user-assisted construction of documents from archived construction of documents from archived content or database contentcontent or database content
Create sales reports from financial and Create sales reports from financial and forecast data stored in a CRM systemforecast data stored in a CRM system
Content ReuseContent ReuseMuch easier to move content between Much easier to move content between documents, including different document documents, including different document typestypes
Apply content stored in Word documents Apply content stored in Word documents to Web pages quickly and efficientlyto Web pages quickly and efficiently
Content TaggingContent TaggingAdd domain-specific metadata to Add domain-specific metadata to document content to enable custom document content to enable custom solutions solutions
Tag presentations using a specific Tag presentations using a specific taxonomy to improve knowledge taxonomy to improve knowledge management efficiency management efficiency
Document InterrogationDocument InterrogationQuery document repositories based on Query document repositories based on custom data, content types or document custom data, content types or document metadatametadata
Search for all documents containing a Search for all documents containing a specific company name or sales contactspecific company name or sales contact
Document SanitizationDocument SanitizationRemove unwanted content like Remove unwanted content like comments or embedded code from your comments or embedded code from your document when appropriatedocument when appropriate
Remove all tracked changes and Remove all tracked changes and comments from a Word document before comments from a Word document before it is publishedit is published
Default file formatDefault file formatMore efficient storageMore efficient storageProgram against full Program against full document contentsdocument contentsBackward compatibility & Backward compatibility & legacy supportlegacy supportEasy document assembly, Easy document assembly, conversion & integrationconversion & integrationSubmitted to ECMA for Submitted to ECMA for standardizationstandardization
Open XML Formats Open XML Formats ArchitectureArchitecture
User view:single Office “file”
Questionnaire.docx Developer view:
modular file
Document PartsDocument PartsMost parts are XMLMost parts are XML
Each XML part is a discreet, Each XML part is a discreet, compressed componentcompressed component
Can add, extract and modify Can add, extract and modify individual parts without using individual parts without using Office programsOffice programs
Corruption or absence of any Corruption or absence of any part would not prohibit the file part would not prohibit the file from being openedfrom being opened
Open XML File FormatsOpen XML File Formats
SOLUTION DEVELOPMENTSOLUTION DEVELOPMENT
Solution development with the new Open XML File Formats
(OR: Great. Now do I make use of this from code?)
Tools for Accessing Data Tools for Accessing Data In Office Open XML filesIn Office Open XML files
XML EditingXML EditingNotepad?Notepad?
System.XML makes this easierSystem.XML makes this easier
ZIP ManipulationZIP ManipulationCompressed Folders in Windows? Compressed Folders in Windows?
Third-Party Zip LibrariesThird-Party Zip Libraries
Microsoft’s Packaging API’sMicrosoft’s Packaging API’s
Office Open XML Resource KitOffice Open XML Resource KitCode Snippets - Beta 2Code Snippets - Beta 2
C# and VB.NETC# and VB.NET
Validation LibraryValidation LibraryParses a file and reports on schema, relationship errors and Parses a file and reports on schema, relationship errors and warnings warnings
Serialization/Deserialization LibrarySerialization/Deserialization LibraryFlattens package into a single file for ease of development in simple Flattens package into a single file for ease of development in simple construction scenarios construction scenarios
System.IO.PackagingSystem.IO.Packaging
Part of .NET Fx 3.0Part of .NET Fx 3.0
Allows you toAllows you toCreate / Open packagesCreate / Open packages
Create and delete parts and relationshipsCreate and delete parts and relationships
Read and write part streamsRead and write part streams
Iterate through collections of parts Iterate through collections of parts and relationshipsand relationships
PackagePackagePackagePartCollectionPackagePartCollection └ └ PackagePartPackagePartPackageRelationshipCollectionPackageRelationshipCollection └ └ PackageRelationshipPackageRelationshipPackUriHelperPackUriHelper
System.IO.Packaging.System.IO.Packaging.PackagPackagee
PackagePackage class provides class provides methods to create, methods to create, enumerate and delete enumerate and delete the following entitiesthe following entities
PackagePackage
Package RelationshipsPackage Relationships
PackagePropertiesPackageProperties
PartsParts
Pack
ag
e R
ela
tionsh
ips
Pack
ag
e R
ela
tionsh
ips
Core PropertiesCore Properties
Common Package Common Package PartsParts
ThumbnailThumbnail
Digital SignaturesDigital Signatures
officeDocumentofficeDocument
XML PartXML Part
XML PartXML Part
Specific Format Specific Format PartsParts
Etc…Etc…
Part
Rels
Part
Rels
XML PartXML Part
Part
Rels
Part
Rels
System.IO.Packaging.System.IO.Packaging.RelationsRelationshiphip
Relationships tie the Relationships tie the parts togetherparts together
Required to find parts (part Required to find parts (part names are not guaranteed)names are not guaranteed)
Iterate through Iterate through RelationshipCollection by RelationshipCollection by Type or IDType or ID
Relationship PropertiesRelationship PropertiesIDID
PackagePackage
RelationshipTypeRelationshipType
SourceUriSourceUri
TargetModeTargetMode
TargetUriTargetUriPack
ag
ePack
ag
e R
ela
tionsh
ips
Rela
tionsh
ips
Core Properties
Common Package Parts
Thumbnail
Digital Signatures
officeDocument
XML Part
XML Part
Specific Format Parts
Etc…Etc…
Part
Rels
Part
Rels
XML Part
Part
Rels
Part
Rels
officeDocumentofficeDocument
XML PartXML Part
XML PartXML Part
XML PartXML Part
System.IO.Packaging.System.IO.Packaging.PackagePPackagePartart
Parts are the objects of data Parts are the objects of data within the Packagewithin the Package
PackagePart provides support to PackagePart provides support to create, enumerate and delete create, enumerate and delete part relationshipspart relationships
Get Part data as StreamGet Part data as Stream
PackagePart Properties:PackagePart Properties:
CompressionOptionCompressionOption
ContentTypeContentType
PackagePackage
UriUri Pack
ag
e R
ela
tionsh
ips
Pack
ag
e R
ela
tionsh
ips
Core Properties
Common Package Parts
Thumbnail
Digital Signatures
officeDocumentofficeDocument
XML Part
XML PartXML Part
Specific Format Specific Format PartsParts
Etc…Etc…
Part
Rels
Part
Rels
XML PartXML Part
Part
Rels
Part
Rels<w:body>- <w:p w:rsidR="001B7EF4" w:rsidRDefault="001B7EF4">- <w:r> <w:t>The Quick Brown Fox jumped over the river.</w:t> </w:r> </w:p>…
XML PartXML Part
<w:body>- <w:p w:rsidR="001B7EF4" w:rsidRDefault="001B7EF4">- <w:r> <w:t>The Cow jumped over the moon.</w:t> </w:r> </w:p>…
Document InterrogationDocument InterrogationScenariosScenarios
When you need meta-data about When you need meta-data about Office files on a serverOffice files on a server
Building reports from data in filesBuilding reports from data in files
Workflow and Content Management Workflow and Content Management scenariosscenarios
Validate complianceValidate compliance
Document AssemblyDocument AssemblyScenariosScenarios
Useful when documents need to be Useful when documents need to be generated from structured datagenerated from structured data
Auto generate reports in Excel from data Auto generate reports in Excel from data
in databasein database
Create documents for users from form Create documents for users from form datadata
Repurpose existing data (slide libraries)Repurpose existing data (slide libraries)
Recommendation:Recommendation: Start from a Start from a templatetemplate
Document SanitizationDocument SanitizationScenariosScenarios
SecuritySecurityRemove active content (VBA, ActiveX)Remove active content (VBA, ActiveX)
PrivacyPrivacyRemove comments, revisions, hidden Remove comments, revisions, hidden texttext
Remove or alter document propertiesRemove or alter document properties
LegalLegalInsert copyrights, watermarks, imagesInsert copyrights, watermarks, images
Run as part of Workflows, publishing, Run as part of Workflows, publishing, compliance scenarioscompliance scenarios
Solution DevelopmentSolution Development
THE DOCUMENT THE DOCUMENT INFORMATION PANELINFORMATION PANEL
Creating smart forms and dynamic documents
(OR: How to leverage the power of InfoPath in your documents. You do know what InfoPath is don’t you?)
Document Information Document Information PanelPanel
Customisable form displayed in the client application
Allows users to enter document properties (metadata) while working on the document
SharePoint properties appear as metadata in the DIP
Custom Information PanelCustom Information Panel
The Document Information Panel uses InfoPath technology
This technology can be used to create business logic around any custom XML data
All the power of InfoPath in WordData connections, declarative rules engine, etc.
Document Info PanelDocument Info Panel
EXERCISING CONTROLEXERCISING CONTROL
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)
The Role Of XMLThe Role Of XMLReference and custom-defined schemasReference and custom-defined schemas
Custom-defined Custom-defined SchemasSchemas
Data-oriented (e.g., Price, Data-oriented (e.g., Price, Invoice)Invoice)
Represents the business Represents the business information stored in the information stored in the documentdocument
Enable System IntegrationEnable System Integration
XML Reference SchemasXML Reference SchemasDisplay-oriented (e.g. Bold, Display-oriented (e.g. Bold, Italics, Tables, Paragraphs, Italics, Tables, Paragraphs, Styles)Styles)
Open Document FormatOpen Document Format
Enable Archival & File Enable Archival & File Formats InteroperabilityFormats Interoperability
The Role Of XMLThe Role Of XMLReference and custom-defined schemasReference and custom-defined schemas
XML Reference SchemasXML Reference SchemasDisplay-oriented (e.g. Bold, Display-oriented (e.g. Bold, Italics, Tables, Paragraphs, Italics, Tables, Paragraphs, Styles)Styles)
Open Document FormatOpen Document Format
Enable Archival & File Enable Archival & File Formats InteroperabilityFormats Interoperability
<w:p><w:p> <w:r><w:r> <w:rPr><w:rPr><w:b /><w:b /></w:rPr></w:rPr> <w:t>John Doe</w:t><w:t>John Doe</w:t> </w:r></w:r> <w:r><w:r> <w:rPr><w:rPr><w:i /><w:i /></w:rPr></w:rPr> <w:t>Health Agency</w:t><w:t>Health Agency</w:t> </w:r></w:r></w:p></w:p>
<ConferenceReport> <Date>3/24/2004</Date> <Attendees> <Attendee Name=“John Doe”> <Department>
Health Agency </Department> <Potential> <Sales>100</Sales> <Growth>25%</Growth> … </Attendee>
Custom-defined Custom-defined SchemasSchemas
Data-oriented (e.g., Price, Data-oriented (e.g., Price, Invoice)Invoice)
Represents the business Represents the business information stored in the information stored in the documentdocument
Enable System IntegrationEnable System Integration
The Role Of XMLThe Role Of XMLReference and custom-defined schemasReference and custom-defined schemas
Content Controls (Word)Content Controls (Word)
Makes structured documents more robust & much less Word specific code needed
Content restrictions, grouping & lockingCode can be used for business logic!
End user friendly and layout independent exposure of structured content
No XML schema requiredEvolution of customer-defined XML with custom XML mapping capabilities(more detail in CD 305)
Solutions And Building Solutions And Building BlocksBlocks
Select and reuse any selection of WordprocessingML
Building blocks and content controls
Two steps to a document assembly solution
Write 18 lines of UI codeMake a few selections and clicks or attach a building block part
Content ControlsContent Controls
MAKING DOCUMENTS MAKING DOCUMENTS WORK FOR YOUWORK FOR YOU
Content Controls + Custom XML Store
= Rich, Robust, Dynamic documents
Office XML Data StoreOffice XML Data Store
Customer-defined XML (incl. WSS/Office properties) stored separately from WordprocessingML 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 WinFX or a client using Word OM
XML MappingXML 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
<Attendees> <Attendee Name=“John Doe”> <Department>
Health Agency </Department> <Potential> <Sales>100</Sales>
…</Attendee>
Content Controls + Custom Content Controls + Custom XMLXML
Dynamic DocumentsDynamic Documents
WHAT ABOUT THE SERVERWHAT ABOUT THE SERVER
Generating Office Documents on the Server
Putting it all togetherPutting it all together
Start with a Template
Document AssemblySystem.IO.PackagingDelete / Create Parts & Relationships
Document ManipulationSystem.IO.PackagingWord -> Content Controls + Custom XMLExcel -> System.Xml + SpreadsheetMLPowerPoint -> System.Xml + PresentationML
Document AssemblyDocument Assembly
On the Server
VISUAL STUDIO TOOLS VISUAL STUDIO TOOLS FOR OFFICEFOR OFFICE
Visual Studio Tools For Visual Studio Tools For OfficeOffice
Tool for building managed applications targeting Office 2003 / Office 2007
The managed code API for OfficeGenerates a lot of the “plumbing” codeVisual designersSeparate date & presentationRobust run-time
FlavoursVSTO 2005, VSTO 2005 SE, VSTO V3 (Orcas)...
VSTO EditionsVSTO Editions
VSTO Versio
n
Office 2003 Office 2007
Additional Informationdoc app doc app
2003
ExcelInfoPat
hWord
Visual Studio .NET 2003
2005
ExcelInfoPat
hWord
Outlook
Data CachingServer-Side ProgrammingIntegrated DesignerSmart TagsActionsPane
2005 SE
ExcelOutloo
kPowerP
ointVisioWord
InfoPath
ExcelInfoPat
hOutloo
kPowerP
ointVisioWord
Rbbon CustomizationCustom TaskPanesOutlook Form RegionsCompatibility
"V3"ExcelWord
ExcelInfoPat
hWord
All
Ribbon CustomizationCustom TaskPanesOutlook Form RegionsNew Security ModelClickOnce DeploymentAppDomain IsolationRuntime Standardization
From Wouter van Vugt (http://blogs.infosupport.com/wouterv)
Visual Studio Tools for Visual Studio Tools for OfficeOffice
Additional ResourcesAdditional Resources
Open XML File Formatshttp://www.openxmldeveloper.ordg
http://blogs.msdn.com/brian_jones
Generalhttp://msdn.microsoft.com/office
http://blogs.msdn.com/dmahugh
http://blogs.msdn.com/erikaehrli
VSTO / Programmabilityhttp://msdn.microsoft.com/office/tool/vsto
http://www.officezealot.com/vsto
http://blogs.msdn.com/kevinboske
http://blogs.msdn.com/eric_carter
Additional InformationAdditional Information
UK MSDN Events Post events page including slide decks
http://www.microsoft.com/uk/msdnevents
Upcoming eventshttp://www.microsoft.com/uk/msdn/events/upcoming.aspx
UK MSDN Site & Flash NewsletterLocal 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.