Microsoft Word XML Watermarks
I have been working on a solution that includes the auto-generation of Word documents using XML, and the resulting documents include a watermark. Inserting watermarks for end-users is as easy as it probably will ever be in Word 2003. All they need to do is go to Format | Background | Printed Watermark. From there, they can insert an image or text. My solution adds an image.
Adding the watermark via an XSLT transform is pretty straightforward, but I did learn something interesting. As you may know, by default, Word assumes that the watermark you add should appear on every page: the first page, and subsequent odd & even numbered pages. You can configure a different watermark for the first page and different watermarks for the odd & even pages. So, you could have three watermarks in the document. Again, by default Word assumes you want the watermark to be the same in all three cases. This explains why, in the WordProcessingML, I found three separate header nodes for the watermark in the section of the document (see Figure)
So, there are three w:hdr elements and they each contain a v:shape element. The attributes for those elements contains information about the image used for the watermark:
<v:shape id="WordPictureWatermark1" o:spid=" _x0000_s2049" type=" #_x0000_t75" style="position:absolute;margin-left:0;margin-top:0;width:6in;height:324pt;z-index:-3;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin" o:allowincell="f">
Only one of the three contains the w:binData for the image (a base-64 encoded jpg). Regrettably, not all of the attributes for the elements in play here have been fully documented. This is where the Word developer community could really shine by creating a WordML wiki for finishing off the documentation. David Thielen did gesture in this direction, but it is an unfinished work.
Rock Thought for the Day: If you are not a metal-head rock and roller, then you probably do not know the categories of heavy metal. Just listing these categories makes me want to step outside for a little sunshine. So, grab a cup of Chamomille tea and brace yourself for: Death Metal (how macabre!), Thrash Metal (it's all about shredding the guitar strings), Speed Metal (some of the soloists can do up to 32 notes per second; essentially synonymous with Thrash), Doom Metal (ie: Cathedral's albums from the mid 90's- very gloomy indeed), and Black Metal (I know next to nothing about it). Whew! Now, if that was too much for you, just hum a John Denver tune: "Sunshine on my shoulders...."
Rock On
Comments
- Anonymous
October 21, 2005
What - no category for Heavy Metal? What gives? :)