Skip to content

Commit

Permalink
TLDR-773 docx table bug fix (#480)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Golodkov <golodkov@ispras.ru>
  • Loading branch information
alexander1999-hub and Alexander Golodkov authored Aug 5, 2024
1 parent 5c597a0 commit ba9b3b4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dedoc/readers/docx_reader/data_structures/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ def to_table(self) -> Table:
if cell.vMerge:
value = cell.vMerge.get("w:val", "continue")
if value == "continue":
cell_lines = cell_list[-1][cell_ind].lines
cell_row_list.append(CellWithMeta(lines=cell_lines, colspan=1, rowspan=1, invisible=True))
last_cell_rowspan = cell_list[rowspan_start_info[cell_ind]][cell_ind]
last_cell_rowspan.rowspan += 1
cell_list[rowspan_start_info[cell_ind]][cell_ind] = last_cell_rowspan
if cell_ind in rowspan_start_info:
cell_lines = cell_list[-1][cell_ind].lines
cell_row_list.append(CellWithMeta(lines=cell_lines, colspan=1, rowspan=1, invisible=True))
last_cell_rowspan = cell_list[rowspan_start_info[cell_ind]][cell_ind]
last_cell_rowspan.rowspan += 1
cell_list[rowspan_start_info[cell_ind]][cell_ind] = last_cell_rowspan
else:
cell_row_list.append(CellWithMeta(lines=cell_lines, colspan=grid_span, rowspan=1, invisible=False))
elif value == "restart":
rowspan_start_info[cell_ind] = row_index
cell_row_list.append(CellWithMeta(lines=cell_lines, colspan=grid_span, rowspan=1, invisible=False))
Expand Down

0 comments on commit ba9b3b4

Please sign in to comment.