OOXML:如何对表头(标题)进行编码?

OOXML:如何对表头(标题)进行编码?,xml,openxml,document,xmldocument,Xml,Openxml,Document,Xmldocument,我在Word 2007中创建了两个文档。两张桌子都是空的。其中一个选中了“标题”选项。我无法确定切换标题的两个文档之间有什么不同 唯一不同的是w:tblLook元素上的w:val属性。标题开关打开时,在文档上将其设置为04A0。如果未勾选“标题”选项,则该值为0480 文件规定w:val的有效值为: 0×0020 Apply first row conditional formatting 0×0040 Apply last row conditional formatting 0×0080

我在Word 2007中创建了两个文档。两张桌子都是空的。其中一个选中了“标题”选项。我无法确定切换标题的两个文档之间有什么不同

唯一不同的是w:tblLook元素上的w:val属性。标题开关打开时,在文档上将其设置为04A0。如果未勾选“标题”选项,则该值为0480

文件规定w:val的有效值为:

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
因此,该数字似乎表示位掩码中设置了32、128和1024

这意味着设置了以下各项:

0×0400  Do not apply column banding conditional formatting
0×0080  Apply first column conditional formatting
0×0020  Apply first row conditional formatting
鉴于0x0400和0x0080似乎不相关,这是关键吗

0×0020  Apply first row conditional formatting

是的,
0x0020
(应用第一行条件格式)是 “标题”选项的键

w:tblLook
元素的
w:val
属性是所谓的 过渡迁移功能,并且只能在 过渡一致性类(MS Word 2007生成此类文档)

请参阅ECMA Office Open XML第4部分- 过渡迁移功能规范

了解更多信息。 段落14.3.11描述了
w:tblLook
的附加属性(
w:val
)。 您可以在这里下载规范。使用ECMA-376第4版第4部分链接

在新版本的Microsoft Office(>2007)中,仅使用
w:val
属性 为了向后兼容。有一个新属性名为
w:firstRow=“1”
,用于
0x0020
值(第一行条件格式)。有关
w:firstRow
属性的更多信息,请参见以下链接

如果将MS Word 2007文档与MS Word 2010/2013文档进行比较,您会注意到 MS Word 2007仅使用
w:val
属性,而MS Word 2010/2013使用
w:val
和 属性
w:firstColumn、w:firstRow、w:lastRow、lastColumn、w:noHBand、w:noVBand

如果以“严格打开XML文档”模式保存word文档(MS word 2013),则
w:val
属性将转换为
w:firstColumn、w:firstRow、w:lastRow、lastColumn、w:noHBand和w:noVBand
属性(因为新的严格文档不应使用
w:val