A developer has created a Python-based method to convert DOCM files to DOCX format without using Microsoft Word or COM objects. The solution operates at the file level by treating the documents as ZIP archives containing XML files.

The process involves removing VBA-related files, such as vbaData.xml and vbaProject.bin, and modifying the [Content_Types].xml and document.xml.rels files. The script updates XML elements to ensure compatibility with the python-docx library.

The conversion logic was tested on files generated in Microsoft Office 2007, 2010, and 2016, as well as LibreOffice 7.5.3.2 and 26.8.0.3. The resulting files were successfully processed using python-docx version 1.1.2.

The author notes that while LibreOffice can create DOCM files, it does not store VBA macros within them. The implemented solution addresses specific XML structure requirements and conflicts introduced by different versions of Microsoft Office.