如何检测包含(水平)合并单元格的 Word 表格?
当 Word 表格包含水平合并的单元格时,访问 aTable.Columns.First 或对 aTable.Columns 执行 For Each 将导致错误。
有没有办法确定表格是否包含水平合并的单元格而不导致错误?
我已阅读确定 Word 单元格是否合并,但是是关于检测特定的 Word 表格单元格是否被合并,而不是整个表格是否有任何合并的单元格。
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?
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在本文中找到了对 Table 对象上的 Uniform 属性的引用,该属性将返回 false if该表已合并或拆分单元格。
虽然这并不表明单元格是水平合并还是垂直合并(或两者兼而有之),但这是一个开始,该属性回答了我的问题。
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.
是的,它就在那里。
这是如何检测垂直合并单元格的逻辑解释。水平合并的单元格也可以检测,但需要更多的编码。
Yes, it's there.
Here is the logical explanation how you will detect vertically merged cells. Horizontally merged cell also can detect, but it will need some more coding.