Skip to content

Does the python-docx library not support docx documents of strict open xml created by Microsoft office? #1520

Description

@yunnan66

The situation is like this. According to the introduction of the python-docx library, it can operate Microsoft Word 2007+ (.docx) files. I use python-docx to parse a docx format document created by Microsoft office with strict open xml. Will the library directly throw an exception?

"no relationship of type 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument' in collection"

I'm using python-docx version 1.1.2 under python3.8. I found some similar issues in the issue list, but I have a problem. python-docx only supports operating on docx documents with open xml. But do docx documents that do not support strict open xml? If docx documents really do not support strict open xml, what is the reason? Although I observed that the xml namespaces of the two are different

Activity

  1. scanny commented on May 18, 2026

    @scanny
    Contributor

    The big reason is the namespace differences, although I expect there are additional schema differences, like some things are allowed and others aren't. So initially it would be the research time and thinking through how both could be supported with a single code base.

    The other aspect though is that it doesn't seem to be very commonly used. Can you say something about why the documents you're encountering use that format?

  2. scanny commented on May 18, 2026

    @scanny
    Contributor

    Okay, with just a cursory look, I think this is a partial answer to some of the questions I posed:

    • The gist of strict-ooxml is it removes all Microsoft-proprietary extensions and legacy accommodations.
    • This makes it interesting for governments and archiving where you don't want to depend on Microsoft for reading or producing the files.
    • Reading strict-ooxml files is likely more or less a subset of reading transitional-ooxml, so probably an easier job.
    • Gating write operations to only those supported by strict-ooxml is probably much harder and more invasive to the existing code base.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions