Reputation: 3729
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?
Upvotes: 5
Views: 1230
Reputation: 371
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:
Upvotes: 0
Reputation: 5095
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.
Upvotes: 0
Reputation: 81
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.
Upvotes: 1
Reputation: 29153
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...
Upvotes: 2