Removing an embedded macro from an old ODT

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.

  1. Extract content.xml from your ODT file (e.g. using Ark, the KDE archive manager).
  2. 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
  1. 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>
  1. Delete the relevant block and save content.xml.
  2. Replace the original content.xml in 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.

Lascia un commento

Il tuo indirizzo email non sarĂ  pubblicato. I campi obbligatori sono contrassegnati *