PowerPoint 2007 表格:识别合并单元格

发布于 2024-10-04 08:12:29 字数 148 浏览 0 评论 0原文

如何识别 PowerPoint 2007 中的合并单元格?无论如何,我们是否可以找到一个特定的单元格被合并。

2003 年,我们尝试访问单元格的 Fill.Visible 属性,当它抛出错误时,我们可以将该单元格识别为合并单元格。 2007年我们如何实现这一目标?

How do I identify merged cells in PowerPoint 2007? Is there anyway we could find a particular cell is merged.

In 2003 we tried to access the Fill.Visible property of a cell and when it throws an error we can identify the cell as a merged cell. How do we achive this in 2007?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

八巷 2024-10-11 08:12:29

它太硬。然而,我发现的最好方法是检查单元格的宽度。这段代码不是最好的,因为它捕获了每个单元格,但它可能是您的起点:

Dim r As Row
Dim co As Column
Dim c As Cell
For Each co In tbl.Columns
    For Each c In co.Cells
        If c.Shape.Width <> co.Width Then
            Debug.Print "Is merged cell"
        End If
    Next
Next

在单元格 2.1 和 2.2 合并的 2x2 表中(即第二行现在是一个单元格),这将打印“Is合并单元格”两次,因为表内部仍然保留单元格 2.1 和 2.2。但这是一个起点,正如所说的那样......

It's tough. However, the best way I've found is to check the width of the cell. This code isn't the best as it catches every cell, but it could be a starting point for you:

Dim r As Row
Dim co As Column
Dim c As Cell
For Each co In tbl.Columns
    For Each c In co.Cells
        If c.Shape.Width <> co.Width Then
            Debug.Print "Is merged cell"
        End If
    Next
Next

In a 2x2 table where cells 2.1 and 2.2 are merged (i.e. the second row is now one cell), this will print "Is merged cell" twice because internally the table still maintains cells 2.1 and 2.2. But it's a starting point as stated...

给不了的爱 2024-10-11 08:12:29

我认为比较 c1.Left == c2.Left && 会更好。 c1.Top == c2.Top。这意味着 2 个单元格已合并。为了仅遍历所有单元格一次,我只需使用 LINQ 的独特和自定义比较器删除“重复项”。

I think much better would be to compare c1.Left == c2.Left && c1.Top == c2.Top. This would mean that the 2 cells are merged. To traverse all the cells just once I just remove "duplicates" using LINQ's Distinct and custom Comparer.

擦肩而过的背影 2024-10-11 08:12:29

合并在一起的单元格将具有相同的 单元格.形状.名称。不幸的是,虽然这在 PowerPoint 2003 上有效,但在 PowerPoint 2007 上询问这些形状的名称时,您会得到 NotImplementedException。我不知道以后的版本。

Cells that are merged together will have the same cell.Shape.Name. Unfortunately while this works on PowerPoint 2003, you get NotImplementedException when asking for the name of these Shapes on PowerPoint 2007. I don't know about later versions.

笑忘罢 2024-10-11 08:12:29

最近,我深入研究了PowerPoint表格中合并单元格的奥秘。
我最终找到了自己处理合并单元格的方法。

请参考以下链接:
https://stackoverflow.com/a/74563860/6354194

对于合并单元格有一些有用的函数:

  1. 测试是否单元格被合并
  2. 测试如果该单元格是合并区域的第一个(左上角)单元格,
  3. 则获取索引号。合并区域中单元格的数量,从上到下,从左到右
  4. 获取合并区域的宽度和高度
  5. 测试给定单元格是否在合并区域内

Recently, I dug into the mystery of merged cells in the PowerPoint table.
I ended up figuring out my own methods to deal with merged cells.

Please refer to the following link:
https://stackoverflow.com/a/74563860/6354194

There are a few useful functions for merged cells:

  1. test if the cell is merged
  2. test if the cell is the first(Top-Left) cell of the merged area
  3. get the index no. of the cells in the merged area, top to bottom, left to right
  4. get the width and height of merged area
  5. test if the given cells are within a merged area
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文