3. The End…
• The last presentation on WordprocessingML
(!)
• There are a few topics that are not large
enough for individual presentations (or
reference chapters) that we’ll cover today
– Text Box Content
– Subdocuments
– Content Import
– Roundtripping Alternate Content
4. The End…
• There are a few topics that are not large
enough for individual presentations (or
reference chapters) that we’ll cover today
– Text Box Content
– Subdocuments
– Content Import
– Roundtripping Alternate Content
5. Text Box Content
• Within a WordprocessingML document, it is
possible to place rich WordprocessingML
content within any shape (except for
connectors)
– The VML textbox element specifies the presence
of a text box which will contain rich text content
– Within that, the WordprocessingML txbxContent
element contains arbitrary block-level
WordprocessingML content (with a few
restrictions)
6. Text Box Content Example
• Consider a simple WordprocessingML
document with a shape (an oval) containing
rich content: For example:
1) Text with
styles
2) Tables
3) Hyperlinks
4) Pictures
7. Text Box Content Example (cont.)
• The resulting WordprocessingML contains:
– The Vector Markup Language for the shape
– The txbxContent element and within it, the
WordprocessingML for the contents
Block-level
WordprocessingML
Text Box Content
Container
8. Text Box Content Example (cont.)
• Once inside that content, it’s just
WordprocessingML
9. Text Box Content Restrictions
• Restrictions on the content of a text box:
– Cannot have references to other document
stories:
• No comments, footnotes, or endnotes
– Cannot have other txbxContent elements within
them (no nested shapes with rich content)
10. Subdocuments
• Subdocuments in WordprocessingML provide
a way for a single (usually large) document to
be carved into parts
– These parts are each full documents and can be
edited and manipulated independently
– The parts are called subdocuments
11. Subdocuments (cont.)
• Subdocuments have no knowledge that they
are subdocuments
– They’re just regular documents
• However, a document which collates a group
of subdocuments must know where to place
each subdocument within its own contents
– This document is called the master document
12. The Master Document
• This is where WordprocessingML comes in:
– The subDoc element specifies a location where
the entire content of a specified file is imported
into the contents of a master document
– This is done by referencing a relationship of type
http://schemas.openxmlformats.org/officeDocument/200
6/relationships/subDocument
– This relationship targets the desired subdocument
14. Master Document Example (cont.)
• To allow different authors to work on
individual chapters, this book should be
broken into three files:
My chapter
Rex’s chapter
Brian’s chapter
15. Master Document Example (cont.)
• Now, we have four WordprocessingML
documents:
– The master document that orders the chapters
– Three subdocuments
• We can each work on the subdocuments
independently
16. Master Document Example (cont.)
• If we look at the document part’s XML for the
master document, it’s just a listing of the
constituent subdocuments:
17. Master Document Example (cont.)
• The relationships part then tells us where
each subdocument is stored:
18. Master Document Restrictions
• None – the example showed that the only
content of the master document were
subdocument references.
– However, that was a function of the example.
• The master document can contain any
WordprocessingML content + any number of
subdocument references.
19. Content Import
• WordprocessingML is a new format
– This means that there is a wealth of existing
content in other formats (e.g. HTML, RTF) which
customers will want to import into
WordprocessingML documents
• Problem: It’s not easy for simple tools to do
that transformation
20. Content Import (cont.)
• Solution: WordprocessingML provides a
generic mechanism for applications to support
importing any format into a
WordprocessingML document
– Example: I have a database of legal clauses in RTF,
but I want to migrate to document assembly using
WordprocessingML
21. Content Import (cont.)
• This content import allows the main
document to (similar to subdocuments)
reference content in any alternate format
– The alternate content is stored in its own part, and
the afChunk element specifies where it should go
in the main document
– Example: With an application that supports RTF
WordprocessingML, I just need to embed my RTF
into the package
22. Content Import (cont.)
• The set of importable formats is application-
defined, since different applications may want
to implement specific sets of imports
– e.g. WordPerfect WordprocessingML import
23. Content Import Structure
• The alternate format content must be the
target of the appropriate relationship:
http://schemas.openxmlformats.org/officeDocument/2006/r
elationships/afChunk
• Its content type is determined by the content
24. Content Import Example
• Consider a document that starts with content
imported from an HTML file:
25. Content Import Example (cont.)
• To import that content into the
WordprocessingML document, the afChunk
element specifies where it is imported:
Place it
at the
start of
the file
26. Content Import Example (cont.)
• The relationship that it references targets the
appropriate file within the package to import:
27. Content Import Example (cont.)
• And the content is then imported on open –
note that it is henceforth WordprocessingML
28. Roundtripping Alternate Content
• Previously, we’ve discussed the concept of
alternate choice blocks:
Alternate
choice (you
need to
understand
w14)
Fallback choice
29. Roundtripping Alternate Content
(cont.)
• These blocks can occur anywhere in a
WordprocessingML file, and applications must
be able to handle them
– Take the first choice whose requirements are met
– Ignore all others
• However, WordprocessingML also explicitly
defines a set of locations where applications
may choose to store and roundtrip all non-
taken choices under the appropriate
conditions
30. Roundtripping Alternate Content
(cont.)
• These locations are defined using the fsb
element
– The fsb wraps the AlternateContent element, and
contains the taken choice once the file is
preprocessed
The fsb contains
alternate choices
31. Roundtripping Conditions
• Why?
– The fsb tells a WordprocessingML consumer that
it shall roundtrip the non-taken choices under the
following condition:
– The contents of the taken choice are in an
(application-defined) form suitable for storage of
alternate content
• e.g. For Word 2007, the only suitable form is a single
run consisting of a single DrawingML image
33. Roundtripping Alternate Content
Example (cont.)
• The fallback is suitable for Word 2007, so we
preserve the alternate content
Preserve this
choice
Suitable!
34. Disclaimer
This presentation is for informational purposes only, and should
not be relied upon as a substitute or replacement for Microsoft
formal file format documentation, which is available at the
following website: https://msdn.microsoft.com/en-
us/library/cc313118(v=office.12).aspx. Any views or opinions
presented in this material are solely those of the author and do
not necessarily represent those of Microsoft. Microsoft
disclaims all liability for mistakes or inaccuracies in this
presentation.