Microsoft Word - WordML table elements continued

OK- I had a few busy days as we hosted thousands of MVP's here for the 2004 MVP Summit. It was good fun. Let's face it, these MVP's are a vital part of Microsoft's success. I value their contributions greatly. There were lots of new faces, and, as my focus is mostly on Office, it was nice to see some of the usual suspects for Office programmability as well. Stephen Bullen (Excel programming guru) and I had a great chat.

I will blog more about the summit later today, but I wanted to get a few more elements for tables in Word described.

In one of my recent entries I gave the intro (you should probably take a look at one of my earliest blog entries about WordML as well). Now, having set up some of the basic formatting for the table, it's time to start laying out some content. Your key elements are the tr and tc elements. The first is for defining rows, and the second is for defining cells. If you want to set up some properties for a row, you have the trPr and for cells you have tcPr. For example, you may want to set the row height, width, spacing. You can do the same for specific rows. Here is the WordML XML for my table (still goofing with a fictitious message about my friends Chris and Charles):

 <w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="8856" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="A6A6A6"/>
</w:tcPr>
<w:p>
<w:r>
<w:rPr>
<w:b/>
<w:color w:val="FFFFFF"/>
</w:rPr>
<w:t>Notes:</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="8856" w:type="dxa"/>
</w:tcPr>
<w:p>
<w:r>
<w:t>From: Charles Maxson Sent: Tuesday, January 27, 2004 11:38 AM To: John Durant</w:t>
</w:r>
<w:r>
<w:t> Subject: Feedback for Chris Kunicki.</w:t>
</w:r>
<w:r>
<w:t> I would like to know what he does well, what you would like to see him to improve. Thanks </w:t>
</w:r>
<w:r>
<w:t>Charles</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>

You can see that there is a fair amount of repetition, but it is pretty straight-forward. I also did a little bit of editing before posting this XML. The reason why is that runs of strings get separated out into more <w:r><w:t></w:t></w:r> pairs than what I show here. It might seem a little annoying to have so many runs, but they actually make sense when you start going through the XML line by line.

 Rock thought for the day: "I'm so happy, 'cause today I found my friends. They're in my head."

Rock on.