Word XHTML - Tables
This is the fifth post by Zeyad Rajabi who owns the XHTML output from Word's new blogging feature. In earlier posts, Zeyad discussed a general overview of the XHTML, details on XHML compliance, how we map styles to semantics, and bullets and numbering. Today Zeyad is discussing the ways in which output tables.
Today I will be talking about tables in our blogging feature. Similarly to other supported Word features, our XHTML output for tables is not full fidelity. Word 2007 provides you with a rich editing experience that allows you to create a multitude of different types of tables. Our blogging feature only supports a handful of the possible types of tables that can be created in Word 2007.
Below is a table that enumerates all the table related HTML elements and the possible attributes and CSS properties that can be output for those elements.
HTML Elements | HTML Attributes | CSS Properties |
table | borderstyle | border-collapsebackground |
colgroup | - | - |
col | style | width |
tbody | valign | - |
tr | style | background height |
td | colspan rowspanstyle valign | background border-bottom border-left border-right border-top padding-bottom padding-leftpadding-rightpadding-top |
I think the easiest introduction to our XHTML output for tables is to show some sample examples.
Example 1:
This example is the default table style for Word.
One | Two |
Three | Four |
Our XHTML output for the table can be found here.
Example 2:
This example shows shading applied to cells vs. rows.
February | ||||||
M | T | W | T | F | S | S |
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Our XHTML output for the table can be found here.
Example 3:
This example shows difference of fidelity when publishing from Word:
In Word | In Browser |
Our XHTML output for the table can be found here.
Example 4:
This example shows different borders being applied to different cells:
August 2006 | ||||||||||||
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat | ||||||
1 |
2 | |||||||||||
3 |
4 |
5 |
6 |
7 |
8 |
9 | ||||||
10 |
11 |
12 |
13 |
14 |
15 |
16 | ||||||
17 |
18 |
19 |
20 |
21 |
22 |
23 | ||||||
24 |
25 |
26 |
27 |
28 |
29 |
30 | ||||||
31 |
Our XHTML output for the table can be found here.