Download presentation
Presentation is loading. Please wait.
Published byLindsey Gregory Modified over 9 years ago
1
Office Open XML Developer Workshop Office Open XML Overview Štěpán Bechynský
2
Office Open XML Developer Workshop Open XML Specification Part 1: Fundamentals, 173 pages Part 2: Open Packaging Convention, 129 pages Part 3: Primer, 472 pages Part 4: Markup Language Reference, 5219 pages Part 5: Markup Compatibility and Extensibility, 43 pages http://www.ecma-international.org/
3
Office Open XML Developer Workshop Programmer View of Open XML Files ZIP Archive Document Parts XML Parts Binary Parts Typed (RFC 2616) Relationships Connections between parts Content Type Stream A specially-named stream Defines mappings from part names to content types Not itself a part, not URI addressable Folder structure for convenience only DEMO
4
Office Open XML Developer Workshop Files and folders – NO!Parts and relationships – YES How to think about OPC packages
5
Office Open XML Developer Workshop Ecma Office Open XML Specifications WordprocessingMLSpreadsheetMLPresentationML ZIPXML + Unicode DrawingML Content Types Custom XMLBibliography Markup Languages Relationships Metadata Digital Signatures VML (legacy)Equations Open Packaging Convention Core Technologies Vocabularies
6
Office Open XML Developer Workshop WordprocessingML Document Architecture Document body properties fontTable headers/footers images numberingDefinitions styles customXML footnotes/endnotes comments A WordprocessingML file is a collection of multiple subdocuments: The main story Header(s) / Footer(s) Footnote(s) / Endnote(s) Subdocuments Comment(s)
7
Office Open XML Developer Workshop Paragraph Example Simple text formatting at the paragraph/run levels: Paragraph properties specify bold (default for the entire paragraph) The quick brown fox. The quick brown fox. Run properties specify italics (override for this run)
8
Office Open XML Developer Workshop Images An image is a w:pict element inside a run The v:imagedata element is defined in VML: xmlns:v="urn:schemas-microsoft-com:vml" The actual image is referenced via a relationship: The relationship points to an image part in the package: <Relationship Id="rId4” Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image” Target="image1.jpg"/> <Relationship Id="rId4” Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image” Target="image1.jpg"/>
9
Office Open XML Developer Workshop Hyperlinks A hyperlink is nested inside a paragraph, outside a run: The destination is stored in a relationship: Click here for OpenXmlDeveloper.org. <Relationship Id=“linkRel1“ Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink” Target="http://www.openxmldeveloper.org" TargetMode="External" /> <Relationship Id=“linkRel1“ Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink” Target="http://www.openxmldeveloper.org" TargetMode="External" />
10
Office Open XML Developer Workshop SpreadsheetML Workbook properties table chart styles calcChain sharedStrings sheet1..N drawing
11
Office Open XML Developer Workshop Minimal Workbook/Worksheet workbook.xml: sheet1.xml: relationship
12
Office Open XML Developer Workshop Strings in SpreadsheetML Two ways a string can be stored: 1.Inline strings Provided for ease of translation/conversion Useful in XSLT scenarios Excel and other consumers may convert to shared strings 2.An entry in the shared-strings table May be either a simple string or formatted text These approaches may be mixed/combined
13
Office Open XML Developer Workshop Inline Strings Inline string support provides a very simple mechanism for programmatically populating a worksheet Especially useful in XSLT scenarios Excel 2007 converts to shared strings on save If you’re consuming Open XML documents, you must handle both cases: inline strings and/or shared strings To convert our shared-strings example to inline strings, just replace sheetdata: Paris Seattle London Copenhagen Paris London
14
Office Open XML Developer Workshop Shared Strings By default, strings are stored in a shared-strings part: Each unique string is stored once Cells store the index (0-based) of the string This design is based on analysis of typical spreadsheet contents: highly repetitive strings are very common Benefits: Users: reduced file size, improved performance Developers: all strings are in one part, simplifying search, localization, and other common string-handling objectives
15
Office Open XML Developer Workshop Shared Strings: example Worksheet contents: sharedStrings.xml contents: Paris Seattle London Copenhagen 6 string references, 4 unique strings Paris = string 0 0
16
Office Open XML Developer Workshop
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.