如何检测(水平)合并单元格的Word表? [英] How do I detect a Word table with (horizontally) merged cells?
问题描述
当Word表包含水平合并的单元格时,首先访问aTable.Columns.First或对aTable.Columns执行For Each将导致错误.
When a Word table contains horizontally merged cells, accessing aTable.Columns.First or performing a For Each over aTable.Columns will result in an error.
有没有一种方法可以确定一个表是否包含水平合并的单元格而不会导致错误?
Is there a way to determine if a table contains horizontally merged cells without resulting in an error?
我已阅读确定Word单元格是否合并 ,但这是关于检测特定Word表单元是否已合并,而不是整个表是否具有任何合并的单元.
I've read Determine if a Word cell is merged, but that is about detecting if a particular Word table cell is merged, rather than does the whole table have any merged cells.
推荐答案
在这篇文章中找到了参考到Table对象上的Uniform属性,如果表已合并或拆分了单元格,则该属性将返回false.
Found a reference in this article to a Uniform property on the Table object, which will return a false if the table has merged or split cells.
尽管这并不表示单元格是水平合并还是垂直合并(或同时合并),但这是一个开始,并且该属性回答了我的问题.
Though this does not indicate if the cells are horizontally or vertically merged (or both), but it's a start, and the property answers my question.
这篇关于如何检测(水平)合并单元格的Word表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!