How to detect merged cells when reading tables
See original GitHub issueHello, I’ve created a simple .docx document (Word 2010) with a simple 2x2 table, the 1st col is merged as with:
+---+---+
| | b |
+ a +---+
| | c |
+---+---+
When reading this with python the cells (0,0) and (1,0) are different! How can I detect that they are merged on the original document? The text of both cell is indeed ‘a’. But the ‘pointer’ are different. Thanks Python 2.7, docx 0.85
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Detecting merged cells in a word document table
The only way to detect them will be to analyse all the tables with the algorithm you found in the posts linked in...
Read more >Identify the merged cells while reading table : Spire.Doc
Hi Team, We need to identify the merged cells while reading/extracting the content of from the table inside word file.
Read more >How to read Merged Cells from Excel in Power BI ... - YouTube
Learn more about Power Query:https://radacad.com/category/power-query.
Read more >Merge and combine cells in Excel without losing data - Ablebits
None of standard Excel merging options works for the cells inside an Excel table. You have to convert a table to a usual...
Read more >How to recognize merged cells in a table? help!!!!!
Horizontally merged cell also can detect, but it will need some more coding. But, unfortunately, not by calling any WORD VBA method or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It has been a while, but someone else may need this information in future.
As mentioned in previous comment, docx.table._Cell object has property _tc which contains useful information about cell’s span:
The output will be:
From this you will easily understand not only if the cell is merged or not, but also its shape and size.
I’ve found a workaround (though the doc does not stand). With the above table in simple.docx
Regards