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

"Word experienced an error" from missing xmlns #2697

Open
joshkel opened this issue Jul 2, 2024 · 0 comments · May be fixed by #2698
Open

"Word experienced an error" from missing xmlns #2697

joshkel opened this issue Jul 2, 2024 · 0 comments · May be fixed by #2698

Comments

@joshkel
Copy link

joshkel commented Jul 2, 2024

We're using the patcher feature to generate Word documents from user-submitted templates. One of our templates has a very minimal <w:document> header within its word/document.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="https://schemas.openxmlformats.org/wordprocessingml/2006/main">

When we open the resulting Word document, Word reports an error:

Word experienced an error trying to open the file.
Try these suggestions.

  • Check the file permissions for the document or drive.
  • Make sure there is sufficient free memory and disk space.
  • Open the file with the Text Recovery converter.

xmllint seems to think that the problem is caused by missing xmlns namespaces:

word/document.xml:1: namespace error : Namespace prefix wp on inline is not defined
:r></w:p><w:p><w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"
                                                                               ^
word/document.xml:1: namespace error : Namespace prefix wp on extent is not defined
ine distT="0" distB="0" distL="0" distR="0"><wp:extent cx="6400800" cy="4800600"
                                                                               ^
word/document.xml:1: namespace error : Namespace prefix wp on effectExtent is not defined
"><wp:extent cx="6400800" cy="4800600"/><wp:effectExtent t="0" r="0" b="0" l="0"
                                                                               ^

If I manually add the missing namespaces, Word seems happy.

joshkel added a commit to joshkel/docx that referenced this issue Jul 3, 2024
@joshkel joshkel linked a pull request Jul 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant