Skip to content

Tables have incorrect rows' and columns' cells when there are merged cells #422

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

Open
ElBloque opened this issue Jul 31, 2017 · 0 comments
Open
Labels

Comments

@ElBloque
Copy link

Hi, I hope this is an appropriate post, it is my first one raised.
I am running python-docx 0.8.6 and python Python 3.6.1.
Attached is a simplified table that I received for analysis and although it looked like a simple table there were some merged cells at the end of some of the rows:
MergedCells.docx
When I investigated the row's cells and then the columns' cells I found that they were wrong at the bottom of the table (bold below):

  | RowHeaders | Column1 | Column2 | Column2
0|R1 | R1C1 | R1C2 | R1C2
1|R2 | R2C1 | R2C2 | R2C2
2|R3 | R3C1 | R3C2 | R3C2
3|R4 | R4C1 | R4C2 | R5
4|R5C1 | R5C2 | R6 | R6C1
5|R6C2 |   |  

It looks like rows and columns have been created and then cells have been dropped into each space in turn reading left to right then top down. This means that when a row has fewer cells than the column count then the next row's cells are added to this shorter row. 'R%' is the first example in the table above.

#232 shows a solution for this issue: _tc.top, bottom, left, right give correct values when iterating through the table's cells.
I'm putting up this issue to ask whether the rows' and columns' will be corrected?

@scanny scanny added the table label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants