Backgrounds in WordprocessingML

Part 3 (Primer) and Part 4 (Markup Language Reference) of the Ecma Office Open XML spec have many XML markup examples that demonstrate various concepts. Pasting those samples into a minimal test document is a good way to learn about how Open XML works.

When I first tried to do this for the document background sample that appears in Part 4 (§2.1.1), however, I ran into a little problem. Here's what it says in the spec:

That seems pretty clear. The only problem is, it didn't actually seem to work when I opened the document in Word 2007. The background was still plain white. WTF?

After a long day in Paris last week, I showed this little sample to Stephane Crozatier and Wouter Van Vugt. In talking through it together, we figured out what's going on: the background appears in "Full Screen Reading" mode (View, Document Views, Full Screen Reading), but not in the default "Print Layout" view. Attached is a document that shows the behavior — a minimal DOCX with the sample markup above inserted in it.

There is a way to make a background show up in the default Print Layout view, if you'd like. Click the Office button, Word Options, Advanced, and then scroll down to "Show background colors and images in Print Layout view." Make sure that box is checked, and click OK.

And since you're probably wondering: yes, you can set that in the document itself. It's the displayBackgroundShape element in the settings part. Try saving a copy with the "show background" box checked to see how that works.