python-docx-template
python-docx-template copied to clipboard
embedding a visible excel table with replace_zipname works but the old (dummy) table is still visible until modified
Is your feature request related to a problem? Please describe.
We need to embed a visible Excel table (meaning : when looking at the Word document, the table is visible on page, without opening Excel). replace_zipname works (the dummy excel is replaced with the real one) but, when opening the Word document, the old table (probably a screenshot) is still there. Only when clicking over the table Word understands that the table has changed and updates the visible table on page
Describe the solution you'd like
After rendering, Word should be "alerted" that its screenshot is invalid so that the real table is shown on page.
Describe alternatives you've considered
We do not have, at the moment, any workaround to this issue
Additional context
Here is a small test to reproduce (a variant of embedded.py
), nothing new here, the difference is when embedding the dummy Excel using Insert->Table in Word template :
`from docxtpl import DocxTemplate
tpl = DocxTemplate('templates/embedded_excel_table.docx')
context = { 'name': 'John Doe', }
tpl.replace_zipname( 'word/embeddings/Microsoft_Excel_Worksheet.xlsx', 'templates/excel_table.xlsx' )
tpl.render(context) tpl.save('output/embedded_visible_table.docx')`
Attached the Word template and the real Excel table that we would like to see on screen, the last file is the final, rendered output, one should see the dummy table but, by clicking on it, Word replaces it with the real one. embedded_excel_table.docx excel_table.xlsx embedded_visible_table.docx
I am willing to help, it would be really helpful to be pointed in the right direction ( a CRC that should be invalidated ? something else ?)
Thank you very much in advance, this library is wonderful !