You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copied from python-docx-template issue 325, opened by @PaulTerrasi on 2020-11-13.
If the template document has a shape or text box in a for loop, whether it is inline or not, the rendered document will appear as corrupted. Word seems to be able to repair the document, and the shape is duplicated by the loop as expected once that happens.
I have only tested this on Word v16.42 for Mac OS, in case this happens to be specific to certain versions of Word.
Comments from the original thread
@elapouya on 2020-11-16:
I think the reason is that for-loops create duplicate object IDs. There is no plan to renumber such objects in docxtpl. Tagging this issue as enhancement.
@PaulTerrasi fixed in #209. Shapes and text boxes copied by a loop now get their own anchorId, VML shape id and spid, the duplicates Word was complaining about. I checked the XML but not in Word itself, so if you still have a template that triggers the repair prompt, attach it and I will reopen.
Activity
cvas22 commentedon Nov 25, 2026
@PaulTerrasi fixed in #209. Shapes and text boxes copied by a loop now get their own anchorId, VML shape id and spid, the duplicates Word was complaining about. I checked the XML but not in Word itself, so if you still have a template that triggers the repair prompt, attach it and I will reopen.