Search code examples
c#.netvstopowerpointoffice-interop

PowerPoint 2007 Tables: Identify Merged Cells


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?


Solution

  • 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...