Как я могу вставить содержимое типа DOCX, созданное в Ckeditor с помощью HtmlToDocx, в ячейку таблицы, созданной с помощью Python DOCX?
Функция, преобразующая HTML-контент CKeditor в DOCX с помощью HtmlToDocx
def html_to_docs(html):
new_parser.table_style = 'Table Grid'
return new_parser.add_html_to_document(html, document)
Таблица создана Python DOCX таблица
# reportdetails is a django model
table = document.add_table(rows=reportdetails.count()-1, cols=5, style='Table Grid')
table.allow_autofit = True
table.columns[0].width = Cm(2)
table.columns[1].width = Cm(16)
table.columns[2].width = Cm(2)
table.columns[3].width = Cm(2)
table.columns[4].width = Cm(2)
hdr_cells = table.rows[0].cells
hdr_cells[0].text = 'Research Area'
hdr_cells[1].text = 'Findings'
hdr_cells[2].text = 'Impact'
hdr_cells[3].text = 'Recommendations'
hdr_cells[4].text = 'Response'
for reportdetail in reportdetails:
row_cells = table.add_row().cells
row_cells[0].text = reportdetail.scope.scope_name
finding = row_cells[1].add_paragraph()
finding.add_run(str(html_to_docs(reportdetail.findings)))#inserting CKeditor content
row_cells[2].text = reportdetail.impact
row_cells[3].text = reportdetail.recommendations
row_cells[4].text = reportdetail.response
Вывод, который я получаю в документе word genetated
Не посажены деревья должен быть первым выводом, а в ячейке выводов строки Климат таблица с этими буквами и строка после нее должны быть во втором выводе.
Я понятия не имею, почему ячейки выводов содержат None