fix:layout recovery image:xxx.png,err msg: list index out of range (#11405)

pull/11484/head
santlchogva 2024-01-02 10:55:36 +08:00 committed by GitHub
parent a5cb64baaa
commit c27402bf1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -253,18 +253,18 @@ class HtmlToDocx(HTMLParser):
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)