Running macro in centos

I am trying to run the following macro which i picked form Re: [O] [ox-odt] "optimal" width of tables to set optimal column widths on a docx file.

I am running soffice inside docker on centos7 . Yum installed libreoffice-headless- and libreoffice-writer- Copied the xba file to /usr/lib64/libreoffice/presets/basic/Standard/OptimizeColumnWidth.xba . ’

Command being executed is soffice --headless Test.docx “macro:///Standard.OptimizeColumnWidth.OptimizeColumnWidthSaveQuit()” . The execution hangs until i press ctlr+c . I dont think the macro is even run.

If i run the same macro on Mac , /Applications/ --headless ~/Desktop/Test.docx “macro:///Standard.Module1.OptimizeColumnWidthSaveQuit()” , the macro modifies the tables in Test.docx and saves it.

So wondering what i am missing here.

PS: i dont see the ~/.config folder until i run soffice. After i run soffice for the first time , i see it and it contains the macros. I dont see a permission issue too on the ~/.config path.

Basing this suggestion on debug using Windows or Linux Mint as I don’t have Centos, but hopefully this still helps identify the problem.

Try it first without “–headless” to see if you are missing error messages or some query for confirmation etc.

You can also try

soffice Test.docx

to confirm it opens your document.

Check if it’s an error in the macro by opening the Basic IDE, then set a breakpoint at the beginning of the macro. If you then run :

soffice "macro:///Standard.OptimizeColumnWidth.OptimizeColumnWidthSaveQuit()"


soffice Test.docx "macro:///Standard.OptimizeColumnWidth.OptimizeColumnWidthSaveQuit()"

You should see the macro stop at the breakpoint and you can then step through while checking for errors.