Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatted text after subdoc tag corrupts generated docx (cannot be opened by Microsoft Word) #565

Open
ldallolio opened this issue Oct 15, 2024 · 0 comments
Labels

Comments

@ldallolio
Copy link

Describe the bug

When creating a word with a subdoc tag, if there is some formatted text after the subdoc tag, the generated docx document cannot be opened using Microsoft Word. This can happen simply because some underline is added around the subdoc tag (a simple space underlined seem to be enough to corrupt the resulting document.
It might be caused by a run (the underlined text after the subdoc) being "forcefully" included in the subdoc generated paragraph.

To Reproduce

Attached is the subdoc test found in the library code, slightly modified to add some formatting text around the subdoc tag in the template. The template is the only part that we need to change to see this behaviour.
subdoc_corrupted.zip

Expected behavior

The generated document should not be corrupted and Microsoft Word should be able to open it.

Screenshots

Capture d’écran 2024-10-15 154636 Capture d’écran 2024-10-15 155334 Capture d’écran 2024-10-15 155512

Additional context

We cannot always use the {{p subdoc}} syntax because we need some label on the same line. This works fine if there is no underlined text after the tag, but it is easy to add it without being aware and break everything. Since we need to use Microsoft Word to open the files, it is hard to see if the generated docx is corrupted only by using unit tests.

@ldallolio ldallolio added the bug label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant