我在 Word 2007 中创建了两个文档。它们都是空表。一个选中了“标题”选项。我无法确定切换 header 的两个文档之间有什么不同。
我能发现的唯一不同之处是 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 .使用 ECMA-376 第 4 版第 4 部分链接。
在新版本的 Microsoft Office (> 2007) 中,仅使用 w:val
属性
为了向后兼容。有一个名为 w:firstRow="1"
的新属性,用于
0x0020
值(第一行条件格式)。请参阅以下链接 MSDN获取有关 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
)。
关于xml - OOXML : How is a table header (heading) encoded?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23134215/