fix:layout recovery image:xxx.png,err msg: list index out of range (#11405)
parent
a5cb64baaa
commit
c27402bf1f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue