Skip to content

Commit

Permalink
pdf2docx/table/Cell.py: add extra info if docx_cell.merge() raises ex…
Browse files Browse the repository at this point in the history
…ception.
  • Loading branch information
julian-smith-artifex-com committed May 27, 2024
1 parent f383d52 commit c10ae4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pdf2docx/table/Cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ def make_docx(self, table, indexes):
docx_cell = table.cell(i, j)
if n_row*n_col!=1:
_cell = table.cell(i+n_row-1, j+n_col-1)
docx_cell.merge(_cell)
try:
docx_cell.merge(_cell)
except Exception as e:
def show(c):
return f'[_tc.top={c._tc.top} _tc.bottom={c._tc.bottom}]'
raise Exception(f'Failed to merge docx_cell={show(docx_cell)} _cell={show(_cell)}. {i=} {j=} {n_row=} {n_col=}') from e

# ---------------------
# cell width (cell height is set by row height)
Expand Down

0 comments on commit c10ae4c

Please sign in to comment.