Chapter 32. Office Open XML Essentials

In my favorite novel, Alexandre Dumas’ The Count of Monte Cristo, the imprisoned Abbe Faria wrote a book without access to paper or writing implements. A 19th century genius resourceful enough to turn MacGyver green with envy, the good Abbe fashioned a pen out of a fishbone, ink out of soot and wine, and 12 rolls of parchment from two shirts. Not bad for an old man who was locked away in a dungeon.

In previous versions of Microsoft Office, the idea of editing a document without first opening the program in which it’s created is much like writing a book in a 19th century dungeon. Without the know-how of an Abbe Faria (or, in this case, a software engineer of equal talent), you’re probably out of luck.

Well, thanks to the ingenuity of some talented software engineers, you no longer need to be a fictional genius (or hold an advanced computer science degree) to understand every bit of a document’s structure well enough even to create one from scratch (if you’re so inclined). Though you never have to know a thing about the XML behind your documents to use the 2007 Microsoft Office release programs, the benefits of getting to know the Office Open XML Formats can be great. Using the XML content for these new file formats, advanced Microsoft Office users can see and understand literally everything that goes into a 2007 release document.

The transparency of the new file formats can save time, add flexibility, improve integration with external content, and simplify essential tasks such as protecting the private content in your documents or troubleshooting document problems. But, my favorite thing about these new formats is just the fact that you don’t have to be a programmer to reap many of the aforementioned benefits.

It’s important to reinforce that this is not an introduction to the XML programming language, but to the Office Open XML Formats. That said, in this primer, you’ll learn to understand the structure of an Office Open XML Format document and how to edit documents directly in their XML. You will also learn the basics of how to customize the Ribbon and how to create custom XML for binding data to document content.

Chapter Assumptions

As with the preceding Microsoft Visual Basic for Applications (VBA) primer, this chapter assumes not only that this may be the first time you’ve ever seen a line of programming code, but also that you’re an advanced Microsoft Office user and comfortable with the features covered throughout this book.

Though this primer is written for Microsoft Office users and not for programmers, you might have noticed that I’ve already specified advanced users more than once. That’s because incorrectly editing a document’s XML can break a document faster than you can blink.

That statement isn’t meant to scare you away. If you’re an advanced user, learning to edit your documents’ XML can be easy, and you can just as easily learn to quickly fix anything you may inadvertently break. Rather, I mention this primarily for the trainers or tech support professionals among you who might consider sending basic or intermediate users into a document’s XML.

You’ll gain tremendous power and flexibility by being able to edit a document’s XML, but please don’t consider it just another method for accomplishing document tasks—such as just one more option you’d teach in a Microsoft Word course for how to edit the definition of a paragraph style. This is an avenue for those with the skill to take document production and troubleshooting to a new level.

Consider this: If a document were a car, then the document’s XML would be the tools of an auto mechanic. Before you can begin to understand what’s going on under the hood, you need to know how to drive. That said, experienced drivers are going to have a great time with the tools in this chapter.

Note

As with the VBA primer in this book, much of what you’ll learn in this chapter can be applied to any program that uses the Office Open XML Formats. However, because I assume that you’re new to any use of XML, all examples in this chapter use Microsoft Office Word 2007 documents and tasks for consistency.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset