Single figure not displayed after rendering although all others are
Hi, In the report where the error occurs are like 20 plots to be inserted and it works for all except for one. This issue is only a recent one as the report was previously rendered without any issues. But since a week it seems not to work (always the same picture).
I have checked for spelling mistakes, bracket errors and even renamed the plot to see if that helps, but nothing seems to work. I am happy to hear about further comments/suggestions to check what can cause this issue...
Please, could you provide a runnable test case.
We are also experience similar behavior.
We are rendering the word document using the below libraries
- docxtpl version 0.11.3
- jinja2 version 2.11.3
All placeholders and images are rendered properly except the first image.
When the rendered document opened in office 2017 first image render and display properly and when open the same document in office 365 first image is not displayed and all other items are getting correctly. We are getting this abnormal behavior.
Any suggesstions would help here.
I have a similar behaviour, some pictures with replace_pic aren't rendered when others are, and inline image is truncating the document. I can privately send the files if needed.
Did you try v0.12.0 ?
Le lun. 16 août 2021 à 17:27, djes @.***> a écrit :
I have a similar behaviour, some pictures with replace_pic aren't rendered when others are, and inline image is truncating the document. I can privately send the files if needed.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elapouya/python-docx-template/issues/368#issuecomment-899602042, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGY33EHXWSGS6LGFI2WOODT5EU6NANCNFSM5AIJ4D4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
We are also experience similar behavior.
We are rendering the word document using the below libraries
- docxtpl version 0.11.3 - jinja2 version 2.11.3All placeholders and images are rendered properly except the first image.
When the rendered document opened in office 2017 first image render and display properly and when open the same document in office 365 first image is not displayed and all other items are getting correctly. We are getting this abnormal behavior.
Any suggesstions would help here.
My problem is resolved in v0.12.0, Thank You..
Did you try v0.12.0 ?
Yes I'm using v0.12.0, downloaded and installed with pip.
docxtpl (0.12.0) python-docx (0.8.11) docxcompose (1.3.3) jinja2 (2.11.1) six (1.15.0) lxml (4.3.3) setuptools (45.2.0) MarkupSafe>=0.23 (1.1.1)
Strangely, it works with a blank new word document. I'll investigate...
I found that on the two Word versions that I have (2013 and 365):
- On 2013 the image names are recorded randomly (seems better with image insertion ribbon than drag'n'drop but not always).
- On 365, images in documents saved with previous versions keeps their names, but new included image have a default name incremented automatically (Image 1, Image 2...).
So I suggest to give image objects a name in Word with the selection panel (Select>Select panel ; Sélectionner>volet sélection in french).
To help others to debug, to know the word document included pictures names I've added theses lines in your docxtpl/templates.py at line 650
print('filename:', filename)
print('titles:', titles)
print('descriptions:', descriptions)
Hi djes, I am working in Word 365 and only rewriting the template in a complete new word doc was the only way to fix it. So, I assume the lines you added only help for debugging, but did not fix the issue yet? Thanks anyway for all your input so far!
Hi djes, I am working in Word 365 and only rewriting the template in a complete new word doc was the only way to fix it. So, I assume the lines you added only help for debugging, but did not fix the issue yet? Thanks anyway for all your input so far!
Yes, debugging only, and I'm not sure there could be a fix if Word 365 does not keep the image path somewhere.
Anyway it is sufficient to change the name of pictures in the word template and your code accordingly, or you may add the image's name or full path in the alternate text without changing code.