OK- I am back from my long camping vacation. 5 sons, 4,100 miles, mini-van, tents, hospital. That’s my summary of the vacation.
Anyway, a lot of people try to insert one Word XML document into another. Using XML methods on the OM seems to be popular. However, <w:cfChunk> is the best kept secret. Regrettably, there is little out there in this regard. It’s mentioned here and there, but no one wants to explain how to use it. That’s where I come in.
So, here’s the scenario. I have doc1.xml and doc2.xml. They both have unique lists, styles, and fonts. I want to put the contents of doc2 into doc1, but I don’t want to have to negotiate the import of all the styles, fonts, and list merging myself. Can’t Word just do that for me? Yes. It can and it does.
Here’s what you do- in doc1, find the spot where you want the contents of doc2 to appear. Instead of a <w:p>, put in a a <w:cfChunk></w:cfChunk>. Then, take all of the XML excluding the header stuff (bascially, the style, list, and font defs) along with the <body> section with everything in it (include the actual <body> tag!) and paste in the context-free chuck tag of doc1. Save the doc and open it in Word. The applicaiton will do the merging for you, and you have a clean, consistent doc1 with the whole of doc2. If you save doc1 and look at the XML, you will see that you do not have repeated header content. It’s successfully merged.
Rock Thought for the Day: My very best friend, Haini Wolfgramm, brought his wife and 7 kids to my home last Sunday, and he introduced me to the band 311. He had a DVD of one of the band’s live shows. Excellent musicianship (occasionally hokey lyrics, though), and it is clear that they are so comfortable with their skills that they can include any influence they wish without being posers. They have a huge following, and thus have reached the rock band nirvana: being a sell-out to to the industry by providing the music you really want to make.