Skip to content

Commit

Permalink
fix:layout recovery image:xxx.png,err msg: list index out of range (P…
Browse files Browse the repository at this point in the history
  • Loading branch information
santlchogva authored and jzhang533 committed Mar 28, 2024
1 parent 8e40ba6 commit 26727b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ppstructure/recovery/table_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,18 @@ def handle_table(self, html, doc):
cols = get_table_columns(row)
cell_col = 0
for col in cols:
if cell_col >= cols_len:
break

colspan = int(col.attrs.get('colspan', 1))
rowspan = int(col.attrs.get('rowspan', 1))

cell_html = get_cell_html(col)
if col.name == 'th':
cell_html = "<b>%s</b>" % cell_html

docx_cell = table.cell(cell_row, cell_col)

while docx_cell.text != '': # Skip the merged cell
cell_col += 1
docx_cell = table.cell(cell_row, cell_col)
if (cell_col + colspan -1) >= cols_len:
colspan -= 1

cell_to_merge = table.cell(cell_row + rowspan - 1,
cell_col + colspan - 1)
Expand Down

0 comments on commit 26727b1

Please # to comment.