You may occasionally find that an old ODT file contains an embedded macro that you cannot get rid of through LibreOffice Writer’s graphical interface.
Nor does saving the document as DOCX or RTF and then converting it back to ODT necessarily solve the problem.
In this case, you can try the following workaround.
- Extract
content.xmlfrom your ODT file (e.g. using Ark, the KDE archive manager). - If you cannot work with the file because all its contents are on a single line, you can format the XML using this command:
xmllint --format content.xml -o content.xml
- Search for the macro-related event binding, typically in a block like this:
<text:execute-macro>
<office:event-listeners>
...
</office:event-listeners>
</text:execute-macro>
- Delete the relevant block and save
content.xml. - Replace the original
content.xmlin the ODT archive with the modified version (remove the old one first).
That’s it!
Important: Make a backup copy of your original ODT file before starting.