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
Issue Description:
I’m encountering an issue when using docxtpl to insert a .docx file into another. Specifically, I’m trying to insert Test2.docx into Test1.docx, and the resulting document (output.docx) appears correctly in Microsoft Word but gets misformatted in OnlyOffice.
What Happens:
The inserted content from Test2.docx is placed incorrectly within the structure of Test1.docx, particularly inside a single <w:r> element, which causes formatting issues in OnlyOffice.
Microsoft Word handles this insertion correctly, likely because it has more lenient error handling for improperly structured XML, but OnlyOffice fails to interpret the content properly.
Expected Behavior:
When inserting a .docx into another using docxtpl, the content should be placed into a new paragraph or block, not nested inside a single run, so that document formatting is preserved across different platforms, including OnlyOffice.
Steps to Reproduce:
Use docxtpl to insert Test2.docx into Test1.docx using a placeholder ({{ somefile.docx }}).
Generate the output (output.docx).
Open the output file in OnlyOffice, and you will see the formatting issues.
Open the same file in Microsoft Word, and it will appear as expected.
Attached Files: Test1.docx — The main file. Test2.docx — The file being inserted into Test1.docx. output.docx — The result after the insertion.
Screenshot in Word:
Screenshot in OnlyOffice:
Possible Solution:
It seems like the inserted content is not being placed in a correct block-level structure, and it is being wrapped inside a run. If possible, can docxtpl be modified to handle insertions in a way that preserves proper structure for all platforms, including OnlyOffice?
Thank you for any guidance or suggestions to resolve this issue!
The text was updated successfully, but these errors were encountered:
Issue Description:
I’m encountering an issue when using docxtpl to insert a .docx file into another. Specifically, I’m trying to insert Test2.docx into Test1.docx, and the resulting document (output.docx) appears correctly in Microsoft Word but gets misformatted in OnlyOffice.
What Happens:
The inserted content from Test2.docx is placed incorrectly within the structure of Test1.docx, particularly inside a single <w:r> element, which causes formatting issues in OnlyOffice.
Microsoft Word handles this insertion correctly, likely because it has more lenient error handling for improperly structured XML, but OnlyOffice fails to interpret the content properly.
Expected Behavior:
When inserting a .docx into another using docxtpl, the content should be placed into a new paragraph or block, not nested inside a single run, so that document formatting is preserved across different platforms, including OnlyOffice.
Steps to Reproduce:
Use docxtpl to insert Test2.docx into Test1.docx using a placeholder ({{ somefile.docx }}).
Generate the output (output.docx).
Open the output file in OnlyOffice, and you will see the formatting issues.
Open the same file in Microsoft Word, and it will appear as expected.
Attached Files:
Test1.docx — The main file.
Test2.docx — The file being inserted into Test1.docx.
output.docx — The result after the insertion.
Screenshot in Word:

Screenshot in OnlyOffice:

Possible Solution:
It seems like the inserted content is not being placed in a correct block-level structure, and it is being wrapped inside a run. If possible, can docxtpl be modified to handle insertions in a way that preserves proper structure for all platforms, including OnlyOffice?
Thank you for any guidance or suggestions to resolve this issue!
The text was updated successfully, but these errors were encountered: