Question

I have created two documents in Word 2007. Both are empty tables. One has the "header" option checked. I am unable to determine what is different between the two documents that toggles the header.

The only thing I can spot that is different is the w:val attribute on the w:tblLook element. It is set to 04A0 on the document with the heading switch on. Without the "heading" option ticked, this value is 0480.

The documentation states that valid values of w:val are:

0×0020  Apply first row conditional formatting
0×0040  Apply last row conditional formatting
0×0080  Apply first column conditional formatting
0×0100  Apply last column conditional formatting
0×0200  Do not apply row banding conditional formatting
0×0400  Do not apply column banding conditional formatting

This number seems to indicate, therefore, that 32, 128 and 1024 are set in the bitmask.

This implies that the following are set:

0×0400  Do not apply column banding conditional formatting
0×0080  Apply first column conditional formatting
0×0020  Apply first row conditional formatting

Given that 0x0400 and 0x0080 seem to be irrelevant, is this the key?:

0×0020  Apply first row conditional formatting
Was it helpful?

Solution

Yes, the 0x0020 (Apply first row conditional formatting) is the key for the "header" option.

The w:val attribute of the w:tblLook element is a so called transitional migration feature and should only be used in documents of transitional conformance class (MS Word 2007 generates documents of this class).

Please refer to the ECMA Office Open XML Part 4 - Transitional Migration Feature Specification

for more information. Paragraph 14.3.11 describes the addtional attribute (w:val) for w:tblLook. You can download the specification here ECMA. Use the ECMA-376 4th edition Part 4 link.

In new versions of Microsoft Office (> 2007) the w:val attribute is only used for backward compatibility. There is a new attribute called w:firstRow="1" for the 0x0020 value (first row conditional formatting). See the following link MSDN to get more information on the w:firstRow attribute.

If you compare a MS Word 2007 document with a MS Word 2010/2013 document you will notice that MS Word 2007 only uses the w:val attribute whereas MS Word 2010/2013 uses the w:val and the attributes w:firstColumn, w:firstRow, w:lastRow, lastColumn, w:noHBand, w:noVBand.

If you save a word document (MS Word 2013) in "Strict Open XML Document" mode the w:val attribute is translated into the w:firstColumn, w:firstRow, w:lastRow, lastColumn, w:noHBand and w:noVBand attributes (because new strict documents should not use w:val).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top