-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to detect merged cells when reading tables #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've found a workaround (though the doc does not stand).
Regards |
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 found that some docx files created by word have inconsistend grid_span attributes in a row. |
The workaround from @0-173 works for me. Thanks! However, the new cell doesn't have any attributes like the "text" field. python2 |
Thank you for your idea. I create a list, and add cell_.tc, then check to skip the 2nd+ merged cells. This is my project: |
Hello, I've created a simple .docx document (Word 2010) with a simple 2x2 table, the 1st col is merged as with:
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
The text was updated successfully, but these errors were encountered: