{
  "id": "task_libraries:docx/python",
  "path": "/exapedia/python-docx-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python Word DOCX libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python DOCX libraries create, read, and convert Microsoft Word documents from Python code. A DOCX file is a zip archive of XML parts that a library can edit without opening Word. These libraries let apps and AI agents generate reports, contracts, and letters as Word files."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python Word DOCX libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#python-docx",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F127"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F128"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F129"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mammoth",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtwotxt",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F157"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtpl",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F174"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F176"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxcompose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F189"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtwopdf",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F206"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtwopython",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F223"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F225"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#aspose-words",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F240"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F82"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F244"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#python-docx",
          "label": [
            {
              "t": "text",
              "text": "python-docx"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F128"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "DOCX authoring",
            "PDF rendering"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#python-docx",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F127"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mammoth",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F151"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtwotxt",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F157"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtpl",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F174"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxcompose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F189"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F199"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F200"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtwopdf",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F206"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F216"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F217"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#docxtwopython",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F223"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F234"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#aspose-words",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F240"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "python-docx",
          "name": [
            {
              "t": "fact",
              "fact": "F127"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/python-openxml/python-docx"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/python-docx"
            },
            {
              "label": "Docs",
              "href": "https://python-docx.readthedocs.org/en/latest/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F11"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F128"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F129"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://python-docx.readthedocs.org/en/latest/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F127"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F12"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/agno-agi/agno",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F140"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def generate_docx_file(\n    self, content: str, filename: Optional[str] = None, title: Optional[str] = None\n) -> ToolResult:\n    \"\"\"Generate a DOCX file from the provided content.\n\n    Args:\n        content: The text content to write to the DOCX file.\n        filename: Optional filename for the generated file. If not provided, a UUID will be used.\n        title: Optional title for the DOCX document.\n\n    Returns:\n        ToolResult: Result containing the generated DOCX file as a FileArtifact.\n    \"\"\"\n    if not DOCX_AVAILABLE:\n        return ToolResult(\n            content=\"DOCX generation is not available. Please install python-docx: pip install python-docx\"\n        )\n\n    try:\n        log_debug(f\"Generating DOCX file with content length: {len(content)}\")\n\n        document = Document()\n\n        if title:\n            document.add_paragraph(title)\n\n        paragraphs = content.split(\"\\n\\n\")\n        for para in paragraphs:\n            if para.strip():\n                document.add_paragraph(para.strip())\n\n        buffer = io.BytesIO()\n        document.save(buffer)\n        docx_content = buffer.getvalue()\n        buffer.close()\n\n        return self._create_file_artifact(\n            docx_content,\n            filename,\n            file_type=\"docx\",\n            mime_type=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n            display_name=\"DOCX\",\n        )\n\n    except Exception as e:\n        logger.exception(\"Failed to generate DOCX file\")\n        return ToolResult(content=f\"Error generating DOCX file: {e}\")",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/agno-agi/agno/blob/821be55d1ec3bb472abe8bd94c3b2a0d6c78392f/libs/agno/agno/tools/file/generation.py#L437-L483",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F139"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20python-docx%20to%20preserve%20Word%20relationships%2C%20render%20document%20templates%20and%20handle%20embedded%20DOCX%20images&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F127"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from docx import Document\ndocument = Document()\ndocument.add_paragraph('Hello, world.')\ndocument.save('output.docx')\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://python-docx.readthedocs.io/en/latest/user/quickstart.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "index.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F132"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "mammoth",
          "name": [
            {
              "t": "fact",
              "fact": "F142"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mwilliamson/python-mammoth"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/mammoth"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/mammoth/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F36"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/mammoth/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F142"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F37"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F38"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/microsoft/markitdown",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F155"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def convert_image(self, image: Any) -> list[Any]:\n    stream_info = StreamInfo(\n        mimetype=image.content_type,\n        extension=(\n            mimetypes.guess_extension(image.content_type)\n            if image.content_type\n            else None\n        ),\n    )\n    with image.open() as image_stream:\n        try:\n            fragment = self._render(image_stream, stream_info, **self._options)\n        except InvalidFileReferenceError as exc:\n            # Mammoth swallows this exception for missing document images,\n            # but an error raised by the override must reach the dispatcher.\n            raise RuntimeError(\"_image_to_html failed\") from exc\n    soup = _parse_image_html(fragment)\n    if soup is None:\n        return images.data_uri(image)\n\n    key = str(len(self._fragments))\n    self._fragments[key] = soup\n    return [html.element(\"img\", {self._attribute: key})]",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/microsoft/markitdown/blob/ed178952a6672abdfd35b5f9e76a80b6cefc086e/packages/markitdown/src/markitdown/converter_utils/docx/_images.py#L60-L82",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F154"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20mammoth%20to%20preserve%20Word%20relationships%2C%20render%20document%20templates%20and%20handle%20embedded%20DOCX%20images&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F142"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import mammoth\nwith open('input.docx', 'rb') as source:\n    result = mammoth.convert_to_html(source)\nhtml = result.value\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/mwilliamson/python-mammoth",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F147"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "docxtwotxt",
          "name": [
            {
              "t": "fact",
              "fact": "F157"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/ankushshah89/python-docx2txt"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/docx2txt"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/docx2txt/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F164"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/docx2txt/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F157"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F172"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/langchain-ai/langchain-community",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F172"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def load(self) -> List[Document]:\n    \"\"\"Load given path as single page.\"\"\"\n    import docx2txt\n\n    return [\n        Document(\n            page_content=docx2txt.process(self.file_path),\n            metadata={\"source\": self.original_file_path},\n        )\n    ]",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/langchain-ai/langchain-community/blob/f425a3ed1933173fb3694b81359d1519c4f82d36/libs/community/langchain_community/document_loaders/word_document.py#L55-L64",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F171"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=docx2txt%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F157"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import docx2txt\ntext = docx2txt.process('input.docx')\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/ankushshah89/python-docx2txt",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F162"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "docxtpl",
          "name": [
            {
              "t": "fact",
              "fact": "F174"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/elapouya/python-docx-template"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/docxtpl"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/docxtpl/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F62"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F176"
                }
              ]
            },
            {
              "label": "Runs on",
              "value": [
                {
                  "t": "fact",
                  "fact": "F57"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/docxtpl/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F174"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F63"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F70"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F187"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/OCA/reporting-engine",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F187"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _render_docx(self, report_ref, res_ids, data=None):\n    report = self._get_report(report_ref)\n    if report.docx_multi_mode == \"zip\" and len(res_ids) > 1:\n        zip_buffer = io.BytesIO()\n        with ZipFile(zip_buffer, \"a\") as zip_file:\n            for res_id in res_ids:\n                docx, ext = self._render_docx(report_ref, [res_id], data=data)\n                zip_file.writestr(\n                    self._render_docx_filename(report, [res_id], data, ext),\n                    docx,\n                )\n        return zip_buffer.getvalue(), \"zip\"\n    template = DocxTemplate(io.BytesIO(b64decode(report.docx_template)))\n    template.render(self._render_docx_eval_context(report, res_ids, data))\n    result = io.BytesIO()\n    template.save(result)\n    return result.getvalue(), \"docx\"",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/OCA/reporting-engine/blob/eebd72b4e2b6b60c35972e6a3ee5d7de310bec8e/report_docx/models/ir_actions_report.py#L112-L128",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F186"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20docxtpl%20to%20preserve%20Word%20relationships%2C%20render%20document%20templates%20and%20handle%20embedded%20DOCX%20images&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F174"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from docxtpl import DocxTemplate\ntemplate = DocxTemplate('template.docx')\ntemplate.render({'name': 'Ada'}, autoescape=True)\ntemplate.save('output.docx')\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docxtpl.readthedocs.io/en/latest/",
                  "label": [
                    {
                      "t": "text",
                      "text": "latest.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F179"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "docxcompose",
          "name": [
            {
              "t": "fact",
              "fact": "F189"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/4teamwork/docxcompose"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/docxcompose"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/docxcompose/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F196"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F192"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/docxcompose/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F189"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F204"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/153lsr/thesis-typeset",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F204"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def insert_custom_cover_via_compose(target_doc_path, cover_path, output_path):\n    \"\"\"\n    使用 docxcompose 合并文档，保留更多格式信息。\n\n    需要安装: pip install docxcompose\n\n    Args:\n        target_doc_path: 目标文档路径\n        cover_path: 封面文档路径\n        output_path: 输出文档路径\n\n    Returns:\n        bool: 成功返回 True，失败返回 False\n    \"\"\"\n    try:\n        from docxcompose.composer import Composer\n\n        target = Document(target_doc_path)\n        cover = Document(cover_path)\n\n        composer = Composer(target)\n        composer.append(cover)\n\n        composer.save(output_path)\n        return True\n    except ImportError:\n        print(\"警告: 未安装 docxcompose，可使用 'pip install docxcompose' 安装\")\n        return False\n    except Exception as e:\n        print(f\"docxcompose 合并失败: {e}\")\n        return False",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/153lsr/thesis-typeset/blob/84b01d7555673374c777c7785954ec086d78bb49/thesis_formatter/cover.py#L67-L97",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F203"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=docxcompose%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F189"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from docx import Document\nfrom docxcompose.composer import Composer\ncomposer = Composer(Document('master.docx'))\ncomposer.append(Document('append.docx'))\ncomposer.save('combined.docx')\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/4teamwork/docxcompose",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F194"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "docxtwopdf",
          "name": [
            {
              "t": "fact",
              "fact": "F206"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/AlJohri/docx2pdf"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/docx2pdf"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/docx2pdf/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F213"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/docx2pdf/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F206"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/rtcatc/Packer-Fuzzer",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F221"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def CreatMe(self):\n    try:\n        convert(self.new_filepath,self.pdf_filepath)\n        self.log.debug(\"正确获取到pdf转化模块\")\n    except Exception as e:\n        self.log.error(\"[Err] %s\" % e)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/rtcatc/Packer-Fuzzer/blob/bd7c98009e7df6aaa32daa86676ad6887388929c/lib/reports/CreatPdf.py#L16-L21",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F220"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=docx2pdf%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F206"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from docx2pdf import convert\nconvert('input.docx', 'output.pdf')\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/AlJohri/docx2pdf",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F211"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "docxtwopython",
          "name": [
            {
              "t": "fact",
              "fact": "F223"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/ShayHill/docx2python"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/docx2python"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/docx2python/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F230"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F226"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F225"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/docx2python/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F223"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F238"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/AccentuSoft/LinkScope_Client",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F238"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def resolution(self, entityJsonList, parameters):\n    from docx2python import docx2python\n    import magic\n    from pathlib import Path\n\n    returnResults = []\n\n    for entity in entityJsonList:\n        uid = entity['uid']\n        filePath = Path(parameters['Project Files Directory']) / entity['File Path']\n\n        if not filePath.exists() or not filePath.is_file():\n            continue\n\n        if magic.from_file(str(filePath), mime=True) != \\\n                'application/vnd.openxmlformats-officedocument.wordprocessingml.document':\n            continue  # We only care about docx files\n\n        metadata = docx2python(filePath)\n\n        data = metadata.properties\n        defaultDateProperties = ['created', 'modified']\n\n        modifiedDate = str(data.get('modified'))\n        modifiedDate = modifiedDate.replace('Z', '')\n        returnResults.append([{'Date': modifiedDate,\n                               'Entity Type': 'Date'},\n                              {uid: {'Resolution': 'modified', 'Notes': ''}}])\n        createdDate = str(data.get('created'))\n        createdDate = createdDate.replace('Z', '')\n        returnResults.append([{'Date': createdDate,\n                               'Entity Type': 'Date'},\n                              {uid: {'Resolution': 'created', 'Notes': ''}}])\n\n        returnResults.extend([{'Phrase': f'{metadataKey}: {str(data.get(metadataKey))}', 'Entity Type': 'Phrase'},\n                              {uid: {'Resolution': metadataKey, 'Notes': ''}}] for metadataKey in\n                             [dataKey for dataKey in data if dataKey not in defaultDateProperties])\n\n    return returnResults",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/AccentuSoft/LinkScope_Client/blob/16be1c5ee4e5aecc5d0b07a61841046341fe70ec/Core/Resolutions/Core/ExtractDOCXMeta.py#L18-L56",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F237"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=docx2python%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F223"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from docx2python import docx2python\nwith docx2python('input.docx') as document:\n    text = document.text\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/ShayHill/docx2python",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F228"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "aspose-words",
          "name": [
            {
              "t": "fact",
              "fact": "F240"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/aspose-words"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/aspose-words/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F89"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F82"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F243"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/aspose-words/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F240"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F90"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F91"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F92"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F93"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F94"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F95"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import aspose.words as aw\ndocument = aw.Document('input.docx')\ndocument.save('output.pdf')\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://reference.aspose.com/words/python-net/aspose.words/document/save/",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20aspose-words%20to%20preserve%20Word%20relationships%2C%20render%20document%20templates%20and%20handle%20embedded%20DOCX%20images&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F240"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F245"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python DOCX library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#python-docx",
          "label": [
            {
              "t": "text",
              "text": "python-docx"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits creating and editing Word files paragraph by paragraph. "
        },
        {
          "t": "link",
          "href": "#docxtpl",
          "label": [
            {
              "t": "text",
              "text": "docxtpl"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits filling a Word template with Jinja-style tags. "
        },
        {
          "t": "link",
          "href": "#mammoth",
          "label": [
            {
              "t": "text",
              "text": "Mammoth"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits converting DOCX into clean HTML."
        }
      ]
    },
    {
      "q": "What is python-docx?",
      "a": [
        {
          "t": "link",
          "href": "#python-docx",
          "label": [
            {
              "t": "text",
              "text": "python-docx"
            }
          ]
        },
        {
          "t": "text",
          "text": " creates, reads, and updates Microsoft Word .docx files. Its document API covers paragraphs, tables, sections, and inline shapes."
        }
      ]
    },
    {
      "q": "What is docxtpl?",
      "a": [
        {
          "t": "link",
          "href": "#docxtpl",
          "label": [
            {
              "t": "text",
              "text": "docxtpl"
            }
          ]
        },
        {
          "t": "text",
          "text": " fills a template authored in Word with Jinja tags and values from a Python context. It also supports rich text and subdocuments."
        }
      ]
    },
    {
      "q": "How do I convert DOCX to PDF in Python?",
      "a": [
        {
          "t": "link",
          "href": "#docxtwopdf",
          "label": [
            {
              "t": "fact",
              "fact": "F206"
            }
          ]
        },
        {
          "t": "text",
          "text": " converts DOCX to PDF on Windows or macOS through an installed copy of Microsoft Word. "
        },
        {
          "t": "link",
          "href": "#aspose-words",
          "label": [
            {
              "t": "text",
              "text": "aspose-words"
            }
          ]
        },
        {
          "t": "text",
          "text": " renders Word documents to other formats without Office."
        }
      ]
    },
    {
      "q": "How do I extract text from a DOCX file in Python?",
      "a": [
        {
          "t": "link",
          "href": "#docxtwotxt",
          "label": [
            {
              "t": "fact",
              "fact": "F157"
            }
          ]
        },
        {
          "t": "text",
          "text": " extracts plain text, including headers, footers, and hyperlinks, and can save embedded images. "
        },
        {
          "t": "link",
          "href": "#docxtwopython",
          "label": [
            {
              "t": "fact",
              "fact": "F223"
            }
          ]
        },
        {
          "t": "text",
          "text": " returns nested body, header, and footer content with images."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, python-docx",
      "display": "python-docx",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, python-docx",
      "display": "134.0M",
      "asOf": "2026-11-16"
    },
    "F3": {
      "label": "License, python-docx",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, python-docx",
      "display": "1.2.0, Jun 2025",
      "asOf": "2025-06-16"
    },
    "F5": {
      "label": "Package release date, python-docx",
      "display": "Jun 2025",
      "asOf": "2025-06-16"
    },
    "F6": {
      "label": "Repository stars, python-docx",
      "display": "5.8K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "DOCX reading, python-docx",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "DOCX writing, python-docx",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Template rendering, python-docx",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Install, python-docx",
      "display": "pip install python-docx",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "What it does, python-docx",
      "display": "Creates and updates Microsoft Word DOCX files.",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "strengths lead, python-docx",
      "display": "Creates Word documents programmatically",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths, python-docx",
      "display": "Add bold or italic text runs to a paragraph.",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths lead, python-docx",
      "display": "Opens existing DOCX files",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths, python-docx",
      "display": "Read and change supported elements in an existing Word document.",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "limitations lead, python-docx",
      "display": "Legacy DOC files need conversion",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations, python-docx",
      "display": "Convert older binary Word documents to DOCX before opening them.",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations lead, python-docx",
      "display": "Paragraph lists skip tracked changes",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations, python-docx",
      "display": "Inspect revision XML separately when inserted or deleted paragraphs must be included.",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "Quickstart, python-docx",
      "display": "from docx import Document\nfrom docx.shared import Inches\n\ndocument = Document()\n\ndocument.add_heading('Document Title', 0)\n\np = document.add_paragraph('A plain paragraph having some ')\np.add_run('bold').bold = True\np.add_run(' and some ')\np.add_run('italic.').italic = True\n\ndocument.add_heading('Heading, level 1', level=1)\ndocument.add_paragraph('Intense quote', style='Intense Quote')\n\ndocument.add_paragraph(\n    'first item in unordered list', style='List Bullet'\n)\ndocument.add_paragraph(\n    'first item in ordered list', style='List Number'\n)\n\ndocument.add_picture('monty-truth.png', width=Inches(1.25))\n\nrecords = (\n    (3, '101', 'Spam'),\n    (7, '422', 'Eggs'),\n    (4, '631', 'Spam, spam, eggs, and spam')\n)\n\ntable = document.add_table(rows=1, cols=3)\nhdr_cells = table.rows[0].cells\nhdr_cells[0].text = 'Qty'\nhdr_cells[1].text = 'Id'\nhdr_cells[2].text = 'Desc'\nfor qty, id, desc in records:\n    row_cells = table.add_row().cells\n    row_cells[0].text = str(qty)\n    row_cells[1].text = id\n    row_cells[2].text = desc\n\ndocument.add_page_break()\n\ndocument.save('demo.docx')\n",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Project function, python-docx",
      "display": "def add_relationship(self, src_part, dst_part, relationship):\n    # ...\n    if relationship.is_external:\n        new_rid = dst_part.rels.get_or_add_ext_rel(\n            relationship.reltype, relationship.target_ref\n        )\n        return dst_part.rels[new_rid]\n\n    part = relationship.target_part\n\n    # Determine next partname\n    name = FILENAME_IDX_RE.match(part.partname).group(1)\n    used_part_numbers = [\n        FILENAME_IDX_RE.match(p.partname).group(2)\n        for p in dst_part.package.iter_parts()\n        if p.partname.startswith(name)\n    ]\n    used_part_numbers = [int(idx) for idx in used_part_numbers if idx is not None]\n\n    for n in range(1, len(used_part_numbers) + 2):\n        if n not in used_part_numbers:\n            next_part_number = n\n            break\n    next_partname = PackURI(\"%s%d.%s\" % (name, next_part_number, part.partname.ext))\n\n    new_part = Part(next_partname, part.content_type, part.blob, dst_part.package)\n    new_rel = dst_part.rels.get_or_add(relationship.reltype, new_part)\n\n    # Sort relationships by rId to get the same rId when adding them to the\n    # new part. This avoids fixing references.\n    def sort_key(r):\n        match = RID_IDX_RE.match(r.rId)\n        return int(match.group(1))\n\n    for rel in sorted(part.rels.values(), key=sort_key):\n        self.add_relationship(part, new_part, rel)\n\n    return new_rel\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function reference, python-docx",
      "display": "composer.py · add_relationship()",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project repository, python-docx",
      "display": "4teamwork/docxcompose",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project stars, 4teamwork/docxcompose",
      "display": "139",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project push date, 4teamwork/docxcompose",
      "display": "Oct 2026",
      "asOf": "2026-10-26"
    },
    "F26": {
      "label": "Library name, mammoth",
      "display": "Mammoth",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Monthly downloads, mammoth",
      "display": "17.3M",
      "asOf": "2026-11-16"
    },
    "F28": {
      "label": "License, mammoth",
      "display": "BSD-2-Clause",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Package release, mammoth",
      "display": "1.13.0, Sep 2026",
      "asOf": "2026-09-26"
    },
    "F30": {
      "label": "Package release date, mammoth",
      "display": "Sep 2026",
      "asOf": "2026-09-26"
    },
    "F31": {
      "label": "Repository stars, mammoth",
      "display": "1.1K",
      "asOf": "2026-11-17"
    },
    "F32": {
      "label": "DOCX reading, mammoth",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "HTML conversion, mammoth",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Output formats, mammoth",
      "display": "HTML",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Install, mammoth",
      "display": "pip install mammoth",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "What it does, mammoth",
      "display": "Converts DOCX documents into semantic HTML.",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "strengths lead, mammoth",
      "display": "Keeps Word heading structure",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "strengths, mammoth",
      "display": "Convert heading styles into semantic HTML headings.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, mammoth",
      "display": "Accepts custom style maps",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, mammoth",
      "display": "Map named Word styles to the HTML elements the application expects.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "limitations lead, mammoth",
      "display": "Generated HTML needs sanitizing",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "limitations, mammoth",
      "display": "Sanitize converted HTML before inserting it into an application page.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, mammoth",
      "display": "External file access stays disabled",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, mammoth",
      "display": "Enable external_file_access only when trusted external document references must be read.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "Quickstart, mammoth",
      "display": "import mammoth\n\nwith open(\"document.docx\", \"rb\") as docx_file:\n    result = mammoth.convert_to_html(docx_file)\n    html = result.value # The generated HTML\n    messages = result.messages # Any messages, such as warnings during conversion\n",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Project function, mammoth",
      "display": "def convert_image(self, image: Any) -> list[Any]:\n    stream_info = StreamInfo(\n        mimetype=image.content_type,\n        extension=(\n            mimetypes.guess_extension(image.content_type)\n            if image.content_type\n            else None\n        ),\n    )\n    with image.open() as image_stream:\n        try:\n            fragment = self._render(image_stream, stream_info, **self._options)\n        except InvalidFileReferenceError as exc:\n            # Mammoth swallows this exception for missing document images,\n            # but an error raised by the override must reach the dispatcher.\n            raise RuntimeError(\"_image_to_html failed\") from exc\n    soup = _parse_image_html(fragment)\n    if soup is None:\n        return images.data_uri(image)\n\n    key = str(len(self._fragments))\n    self._fragments[key] = soup\n    return [html.element(\"img\", {self._attribute: key})]\n",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Project function reference, mammoth",
      "display": "_images.py · convert_image()",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project repository, mammoth",
      "display": "microsoft/markitdown",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project stars, microsoft/markitdown",
      "display": "195.6K",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project push date, microsoft/markitdown",
      "display": "Nov 2026",
      "asOf": "2026-11-07"
    },
    "F51": {
      "label": "Library name, docxtpl",
      "display": "docxtpl",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Monthly downloads, docxtpl",
      "display": "4.4M",
      "asOf": "2026-11-16"
    },
    "F53": {
      "label": "License, docxtpl",
      "display": "LGPL-2.1-only",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Package release, docxtpl",
      "display": "0.20.2, Nov 2025",
      "asOf": "2025-11-13"
    },
    "F55": {
      "label": "Package release date, docxtpl",
      "display": "Nov 2025",
      "asOf": "2025-11-13"
    },
    "F56": {
      "label": "Repository stars, docxtpl",
      "display": "2.7K",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Runtime, docxtpl",
      "display": "Jinja2",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "DOCX reading, docxtpl",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "DOCX writing, docxtpl",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Template rendering, docxtpl",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Install, docxtpl",
      "display": "pip install docxtpl",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "What it does, docxtpl",
      "display": "Fills Word document templates using Jinja-style tags and Python context values.",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "strengths lead, docxtpl",
      "display": "Keeps templates editable in Word",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths, docxtpl",
      "display": "Design the document in Word, then fill its template tags from Python.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths lead, docxtpl",
      "display": "Accepts custom Jinja filters",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths, docxtpl",
      "display": "Pass a Jinja environment containing the template filters the application needs.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "limitations lead, docxtpl",
      "display": "Template tags must stay together",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations, docxtpl",
      "display": "Keep each tag inside one Word run, a single formatted text segment.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "limitations lead, docxtpl",
      "display": "Context escaping starts disabled",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "limitations, docxtpl",
      "display": "Enable autoescape for values containing angle brackets or ampersands.",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Quickstart, docxtpl",
      "display": "from docxtpl import DocxTemplate\nimport jinja2\n\ndef multiply_by(value, by):\n   return value * by\n\ndoc = DocxTemplate(\"my_word_template.docx\")\ncontext = { 'price_dollars' : 5.00 }\njinja_env = jinja2.Environment()\njinja_env.filters['multiply_by'] = multiply_by\ndoc.render(context,jinja_env)\ndoc.save(\"generated_doc.docx\")\n\n",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project function, docxtpl",
      "display": "def _render_docx(self, report_ref, res_ids, data=None):\n    report = self._get_report(report_ref)\n    if report.docx_multi_mode == \"zip\" and len(res_ids) > 1:\n        zip_buffer = io.BytesIO()\n        with ZipFile(zip_buffer, \"a\") as zip_file:\n            for res_id in res_ids:\n                docx, ext = self._render_docx(report_ref, [res_id], data=data)\n                zip_file.writestr(\n                    self._render_docx_filename(report, [res_id], data, ext),\n                    docx,\n                )\n        return zip_buffer.getvalue(), \"zip\"\n    template = DocxTemplate(io.BytesIO(b64decode(report.docx_template)))\n    template.render(self._render_docx_eval_context(report, res_ids, data))\n    result = io.BytesIO()\n    template.save(result)\n    return result.getvalue(), \"docx\"\n",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project function reference, docxtpl",
      "display": "ir_actions_report.py · _render_docx()",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project repository, docxtpl",
      "display": "OCA/reporting-engine",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Project stars, OCA/reporting-engine",
      "display": "447",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Project push date, OCA/reporting-engine",
      "display": "Nov 2026",
      "asOf": "2026-11-13"
    },
    "F77": {
      "label": "Library name, aspose-words",
      "display": "Aspose.Words",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Monthly downloads, aspose-words",
      "display": "453.5K",
      "asOf": "2026-11-16"
    },
    "F79": {
      "label": "License, aspose-words",
      "display": "Other / Proprietary License",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Package release, aspose-words",
      "display": "26.10.0, Oct 2026",
      "asOf": "2026-10-13"
    },
    "F81": {
      "label": "Package release date, aspose-words",
      "display": "Oct 2026",
      "asOf": "2026-10-13"
    },
    "F82": {
      "label": "Repository stars, aspose-words",
      "display": "135",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "DOCX reading, aspose-words",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "DOCX writing, aspose-words",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Template rendering, aspose-words",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "HTML conversion, aspose-words",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "Output formats, aspose-words",
      "display": "PDF, HTML",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "Install, aspose-words",
      "display": "pip install aspose-words",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "What it does, aspose-words",
      "display": "Creates, edits, converts, and renders Word documents locally.",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "strengths lead, aspose-words",
      "display": "Converts Word documents to PDF",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "strengths, aspose-words",
      "display": "Save Word documents as PDF, HTML, or supported image formats.",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "strengths lead, aspose-words",
      "display": "Fills Word mail-merge templates",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "strengths, aspose-words",
      "display": "Generate documents by filling merge templates with application data.",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "limitations lead, aspose-words",
      "display": "Evaluation mode adds watermarks",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "limitations, aspose-words",
      "display": "Apply a license for documents without evaluation watermarks.",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Quickstart, aspose-words",
      "display": "import aspose.words as aw\n\n# Create a blank document.\ndoc = aw.Document()\n\n# Use a document builder to add content to the document.\nbuilder = aw.DocumentBuilder(doc)\n# Write a new paragraph in the document with the text \"Hello World!\".\nbuilder.writeln(\"Hello, World!\")\n\n# Save the document in DOCX format. Save format is automatically determined from the file extension.\ndoc.save(\"Output.docx\")\n",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Quickstart source reference, aspose-words",
      "display": "26.10.0",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Developer need",
      "display": "Creating Word documents from code",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Why choose python-docx",
      "display": "programmatic Word document creation",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Developer need in introduction",
      "display": "creating Word documents from code",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "When to consider docxtpl",
      "display": "the document layout should stay editable in Word",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Developer need",
      "display": "Templates edited in Word",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Why choose docxtpl",
      "display": "Word-authored document templates",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Developer need in introduction",
      "display": "templates edited in Word",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "When to consider python-docx",
      "display": "code should build the document structure",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Developer need",
      "display": "Semantic HTML from DOCX",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Why choose mammoth",
      "display": "semantic heading conversion",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need in introduction",
      "display": "semantic HTML from DOCX",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "When to consider aspose-words",
      "display": "the deliverable needs PDF or image output",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Developer need",
      "display": "Word-to-PDF conversion",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "Why choose aspose-words",
      "display": "direct Word format conversion",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Developer need in introduction",
      "display": "word-to-PDF conversion",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "When to consider mammoth",
      "display": "semantic HTML headings are the main deliverable",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "Page introduction",
      "display": "Python Word DOCX libraries let application developers read or create Word documents.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: What is the best Python Word document library?",
      "display": "Use python-docx to create and update DOCX files.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: What is the best Python Word document library?",
      "display": "Use docxtpl to fill Word-authored templates.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: What is the best Python Word document library?",
      "display": "Use Mammoth to convert document semantics into HTML.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: What is the best Python Word document library?",
      "display": "Aspose.Words converts Word documents into PDF, HTML, and other formats.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Should I use python-docx or docxtpl for templates?",
      "display": "python-docx builds and updates documents through Python objects.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Should I use python-docx or docxtpl for templates?",
      "display": "docxtpl starts from a document edited in Word and fills its template tags.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Can python-docx open older binary Word files?",
      "display": "Convert legacy DOC files to DOCX before opening them with python-docx.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Why do docxtpl tags break after editing the Word file?",
      "display": "Ordinary Jinja tags must stay within the same Word run and paragraph; special structural tags handle larger document units.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Does Mammoth preserve the exact page layout?",
      "display": "Mammoth uses document semantics, such as heading styles, instead of copying exact font, and layout details.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Does converting DOCX to HTML sanitize the result?",
      "display": "Mammoth does not sanitize source documents; sanitize converted HTML before embedding it in an application page.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: Why are tracked changes missing from extracted paragraphs?",
      "display": "python-docx Document.paragraphs omits paragraphs inside insertion and deletion revision marks.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: Why does an Aspose document have a watermark?",
      "display": "The unlicensed evaluation adds a watermark and limits document size; a suitable license removes evaluation restrictions.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "Library name, python-docx",
      "display": "python-docx",
      "asOf": "2026-11-20"
    },
    "F128": {
      "label": "Monthly downloads, python-docx",
      "display": "139.9M",
      "asOf": "2026-11-20"
    },
    "F129": {
      "label": "License, python-docx",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Package release, python-docx",
      "display": "1.2.0",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Package release date, python-docx",
      "display": "Jun 2025",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Install, python-docx",
      "display": "pip install python-docx",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Quickstart, python-docx",
      "display": "from docx import Document\ndocument = Document()\ndocument.add_paragraph('Hello, world.')\ndocument.save('output.docx')\n",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Repository stars, python-docx",
      "display": "5.8K",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "DOCX authoring, python-docx",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "PDF rendering, python-docx",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Document model, python-docx",
      "display": "Paragraphs, tables, sections, and inline shapes",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Project function, python-docx",
      "display": "def generate_docx_file(\n    self, content: str, filename: Optional[str] = None, title: Optional[str] = None\n) -> ToolResult:\n    \"\"\"Generate a DOCX file from the provided content.\n\n    Args:\n        content: The text content to write to the DOCX file.\n        filename: Optional filename for the generated file. If not provided, a UUID will be used.\n        title: Optional title for the DOCX document.\n\n    Returns:\n        ToolResult: Result containing the generated DOCX file as a FileArtifact.\n    \"\"\"\n    if not DOCX_AVAILABLE:\n        return ToolResult(\n            content=\"DOCX generation is not available. Please install python-docx: pip install python-docx\"\n        )\n\n    try:\n        log_debug(f\"Generating DOCX file with content length: {len(content)}\")\n\n        document = Document()\n\n        if title:\n            document.add_paragraph(title)\n\n        paragraphs = content.split(\"\\n\\n\")\n        for para in paragraphs:\n            if para.strip():\n                document.add_paragraph(para.strip())\n\n        buffer = io.BytesIO()\n        document.save(buffer)\n        docx_content = buffer.getvalue()\n        buffer.close()\n\n        return self._create_file_artifact(\n            docx_content,\n            filename,\n            file_type=\"docx\",\n            mime_type=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n            display_name=\"DOCX\",\n        )\n\n    except Exception as e:\n        logger.exception(\"Failed to generate DOCX file\")\n        return ToolResult(content=f\"Error generating DOCX file: {e}\")",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Project source file, python-docx",
      "display": "libs/agno/agno/tools/file/generation.py",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Project full_name, python-docx",
      "display": "agno-agi/agno",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Project stargazers_count, python-docx",
      "display": "43.2K",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Library name, mammoth",
      "display": "Mammoth",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Monthly downloads, mammoth",
      "display": "18.2M",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "License, mammoth",
      "display": "BSD-2-Clause",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Package release, mammoth",
      "display": "1.13.0",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Package release date, mammoth",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Install, mammoth",
      "display": "pip install mammoth",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Quickstart, mammoth",
      "display": "import mammoth\nwith open('input.docx', 'rb') as source:\n    result = mammoth.convert_to_html(source)\nhtml = result.value\n",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Repository stars, mammoth",
      "display": "1.1K",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "DOCX authoring, mammoth",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "PDF rendering, mammoth",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Conversion contract, mammoth",
      "display": "Semantic HTML from DOCX, with explicit style/image handlers",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Project function, mammoth",
      "display": "def convert_image(self, image: Any) -> list[Any]:\n    stream_info = StreamInfo(\n        mimetype=image.content_type,\n        extension=(\n            mimetypes.guess_extension(image.content_type)\n            if image.content_type\n            else None\n        ),\n    )\n    with image.open() as image_stream:\n        try:\n            fragment = self._render(image_stream, stream_info, **self._options)\n        except InvalidFileReferenceError as exc:\n            # Mammoth swallows this exception for missing document images,\n            # but an error raised by the override must reach the dispatcher.\n            raise RuntimeError(\"_image_to_html failed\") from exc\n    soup = _parse_image_html(fragment)\n    if soup is None:\n        return images.data_uri(image)\n\n    key = str(len(self._fragments))\n    self._fragments[key] = soup\n    return [html.element(\"img\", {self._attribute: key})]",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Project source file, mammoth",
      "display": "packages/markitdown/src/markitdown/converter_utils/docx/_images.py",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Project full_name, mammoth",
      "display": "microsoft/markitdown",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Project stargazers_count, mammoth",
      "display": "195.6K",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Library name, docx2txt",
      "display": "docx2txt",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Monthly downloads, docx2txt",
      "display": "5.0M",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "License, docx2txt",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Package release, docx2txt",
      "display": "0.9",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Package release date, docx2txt",
      "display": "Mar 2025",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Install, docx2txt",
      "display": "pip install docx2txt",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Quickstart, docx2txt",
      "display": "import docx2txt\ntext = docx2txt.process('input.docx')\n",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Official description, docx2txt",
      "display": "Extracts text and images from DOCX files in pure Python.",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Quickstart source file, docx2txt",
      "display": "README.md (API recipe)",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Repository stars, docx2txt",
      "display": "584",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "DOCX authoring, docx2txt",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "PDF rendering, docx2txt",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Extraction contract, docx2txt",
      "display": "Plain text including headers/footers/hyperlinks; optional image files",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Project function, docx2txt",
      "display": "def load(self) -> List[Document]:\n    \"\"\"Load given path as single page.\"\"\"\n    import docx2txt\n\n    return [\n        Document(\n            page_content=docx2txt.process(self.file_path),\n            metadata={\"source\": self.original_file_path},\n        )\n    ]",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Project source file, docx2txt",
      "display": "libs/community/langchain_community/document_loaders/word_document.py",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Project full_name, docx2txt",
      "display": "langchain-ai/langchain-community",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Project stargazers_count, docx2txt",
      "display": "285",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Library name, docxtpl",
      "display": "docxtpl",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Monthly downloads, docxtpl",
      "display": "4.7M",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "License, docxtpl",
      "display": "LGPL-2.1-only",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Package release, docxtpl",
      "display": "0.20.2",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Package release date, docxtpl",
      "display": "Nov 2025",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Install, docxtpl",
      "display": "pip install docxtpl",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Quickstart, docxtpl",
      "display": "from docxtpl import DocxTemplate\ntemplate = DocxTemplate('template.docx')\ntemplate.render({'name': 'Ada'}, autoescape=True)\ntemplate.save('output.docx')\n",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Repository stars, docxtpl",
      "display": "2.7K",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "DOCX authoring, docxtpl",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "PDF rendering, docxtpl",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Template contract, docxtpl",
      "display": "Word-authored Jinja templates, rich text, and subdocuments",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Project function, docxtpl",
      "display": "def _render_docx(self, report_ref, res_ids, data=None):\n    report = self._get_report(report_ref)\n    if report.docx_multi_mode == \"zip\" and len(res_ids) > 1:\n        zip_buffer = io.BytesIO()\n        with ZipFile(zip_buffer, \"a\") as zip_file:\n            for res_id in res_ids:\n                docx, ext = self._render_docx(report_ref, [res_id], data=data)\n                zip_file.writestr(\n                    self._render_docx_filename(report, [res_id], data, ext),\n                    docx,\n                )\n        return zip_buffer.getvalue(), \"zip\"\n    template = DocxTemplate(io.BytesIO(b64decode(report.docx_template)))\n    template.render(self._render_docx_eval_context(report, res_ids, data))\n    result = io.BytesIO()\n    template.save(result)\n    return result.getvalue(), \"docx\"",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Project source file, docxtpl",
      "display": "report_docx/models/ir_actions_report.py",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Project full_name, docxtpl",
      "display": "OCA/reporting-engine",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Project stargazers_count, docxtpl",
      "display": "447",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Library name, docxcompose",
      "display": "docxcompose",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Monthly downloads, docxcompose",
      "display": "2.0M",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "License, docxcompose",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Package release, docxcompose",
      "display": "2.2.0",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Package release date, docxcompose",
      "display": "Jun 2026",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Install, docxcompose",
      "display": "pip install docxcompose",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Quickstart, docxcompose",
      "display": "from docx import Document\nfrom docxcompose.composer import Composer\ncomposer = Composer(Document('master.docx'))\ncomposer.append(Document('append.docx'))\ncomposer.save('combined.docx')\n",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Official description, docxcompose",
      "display": "Composes .docx documents.",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Quickstart source file, docxcompose",
      "display": "README.rst (API recipe)",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Repository stars, docxcompose",
      "display": "139",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "DOCX authoring, docxcompose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "PDF rendering, docxcompose",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Composition boundary, docxcompose",
      "display": "Combined body content with master document headers and footers",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Project function, docxcompose",
      "display": "def insert_custom_cover_via_compose(target_doc_path, cover_path, output_path):\n    \"\"\"\n    使用 docxcompose 合并文档，保留更多格式信息。\n\n    需要安装: pip install docxcompose\n\n    Args:\n        target_doc_path: 目标文档路径\n        cover_path: 封面文档路径\n        output_path: 输出文档路径\n\n    Returns:\n        bool: 成功返回 True，失败返回 False\n    \"\"\"\n    try:\n        from docxcompose.composer import Composer\n\n        target = Document(target_doc_path)\n        cover = Document(cover_path)\n\n        composer = Composer(target)\n        composer.append(cover)\n\n        composer.save(output_path)\n        return True\n    except ImportError:\n        print(\"警告: 未安装 docxcompose，可使用 'pip install docxcompose' 安装\")\n        return False\n    except Exception as e:\n        print(f\"docxcompose 合并失败: {e}\")\n        return False",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Project source file, docxcompose",
      "display": "thesis_formatter/cover.py",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Project full_name, docxcompose",
      "display": "153lsr/thesis-typeset",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Project stargazers_count, docxcompose",
      "display": "166",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Library name, docx2pdf",
      "display": "docx2pdf",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Monthly downloads, docx2pdf",
      "display": "581.5K",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "License, docx2pdf",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Package release, docx2pdf",
      "display": "0.1.8",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Package release date, docx2pdf",
      "display": "Dec 2021",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Install, docx2pdf",
      "display": "pip install docx2pdf",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Quickstart, docx2pdf",
      "display": "from docx2pdf import convert\nconvert('input.docx', 'output.pdf')\n",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Official description, docx2pdf",
      "display": "Converts DOCX to PDF on Windows or macOS through an installed copy of Microsoft Word.",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Quickstart source file, docx2pdf",
      "display": "README.md (API recipe)",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Repository stars, docx2pdf",
      "display": "600",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "DOCX authoring, docx2pdf",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "PDF rendering, docx2pdf",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Platform boundary, docx2pdf",
      "display": "Microsoft Word required on Windows or macOS",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Project function, docx2pdf",
      "display": "def CreatMe(self):\n    try:\n        convert(self.new_filepath,self.pdf_filepath)\n        self.log.debug(\"正确获取到pdf转化模块\")\n    except Exception as e:\n        self.log.error(\"[Err] %s\" % e)",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Project source file, docx2pdf",
      "display": "lib/reports/CreatPdf.py",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Project full_name, docx2pdf",
      "display": "rtcatc/Packer-Fuzzer",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Project stargazers_count, docx2pdf",
      "display": "3.2K",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Library name, docx2python",
      "display": "docx2python",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Monthly downloads, docx2python",
      "display": "514.0K",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "License, docx2python",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Package release, docx2python",
      "display": "3.7.2",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Package release date, docx2python",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Install, docx2python",
      "display": "pip install docx2python",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Quickstart, docx2python",
      "display": "from docx2python import docx2python\nwith docx2python('input.docx') as document:\n    text = document.text\n",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Official description, docx2python",
      "display": "Extracts content from DOCX files.",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Quickstart source file, docx2python",
      "display": "README.md (API recipe)",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Repository stars, docx2python",
      "display": "213",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "DOCX authoring, docx2python",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "PDF rendering, docx2python",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Extraction contract, docx2python",
      "display": "Nested body/header/footer data, text, and embedded images",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Project function, docx2python",
      "display": "def resolution(self, entityJsonList, parameters):\n    from docx2python import docx2python\n    import magic\n    from pathlib import Path\n\n    returnResults = []\n\n    for entity in entityJsonList:\n        uid = entity['uid']\n        filePath = Path(parameters['Project Files Directory']) / entity['File Path']\n\n        if not filePath.exists() or not filePath.is_file():\n            continue\n\n        if magic.from_file(str(filePath), mime=True) != \\\n                'application/vnd.openxmlformats-officedocument.wordprocessingml.document':\n            continue  # We only care about docx files\n\n        metadata = docx2python(filePath)\n\n        data = metadata.properties\n        defaultDateProperties = ['created', 'modified']\n\n        modifiedDate = str(data.get('modified'))\n        modifiedDate = modifiedDate.replace('Z', '')\n        returnResults.append([{'Date': modifiedDate,\n                               'Entity Type': 'Date'},\n                              {uid: {'Resolution': 'modified', 'Notes': ''}}])\n        createdDate = str(data.get('created'))\n        createdDate = createdDate.replace('Z', '')\n        returnResults.append([{'Date': createdDate,\n                               'Entity Type': 'Date'},\n                              {uid: {'Resolution': 'created', 'Notes': ''}}])\n\n        returnResults.extend([{'Phrase': f'{metadataKey}: {str(data.get(metadataKey))}', 'Entity Type': 'Phrase'},\n                              {uid: {'Resolution': metadataKey, 'Notes': ''}}] for metadataKey in\n                             [dataKey for dataKey in data if dataKey not in defaultDateProperties])\n\n    return returnResults",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Project source file, docx2python",
      "display": "Core/Resolutions/Core/ExtractDOCXMeta.py",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Project full_name, docx2python",
      "display": "AccentuSoft/LinkScope_Client",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Project stargazers_count, docx2python",
      "display": "500",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Library name, aspose-words",
      "display": "aspose-words",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Monthly downloads, aspose-words",
      "display": "465.1K",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "License, aspose-words",
      "display": "Commercial",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Package release, aspose-words",
      "display": "26.11.0",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Package release date, aspose-words",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Install, aspose-words",
      "display": "pip install aspose-words",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Quickstart, aspose-words",
      "display": "import aspose.words as aw\ndocument = aw.Document('input.docx')\ndocument.save('output.pdf')\n",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "DOCX authoring, aspose-words",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "PDF rendering, aspose-words",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Licensing boundary, aspose-words",
      "display": "Commercial Word rendering SDK; evaluation watermark/limits",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python DOCX Word libraries python-docx docxtpl Mammoth Aspose Words templates HTML PDF code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
