Skip to content

There is a problem extracting table from word when border is not aligned in table(not duplicated columns). #771

Open
@vivia1994

Description

@vivia1994

Greetings,
If the table's border in the docx document is not aligned(Please see below picture).
image

Then the extracted table is incorrect(Please see below picture).
image
The issue is that the value of first cell of next row is added to the last value of last cell of current row.

Here is my code:

            for i, row in enumerate(table.rows):
                prior_tc = None
                for cell in row.cells:
                    this_tc = cell._tc
                    if this_tc is prior_tc:  # skip cells pointing to same `<w:tc>` element
                        continue
                    # yield cell
                    prior_tc = this_tc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions