Ask Your Question

Running macro in centos

asked 2016-08-04 00:48:44 +0100

Ramv gravatar image

I am trying to run the following macro which i picked form 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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-08-23 21:34:35 +0100

mark_t gravatar image

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-08-04 00:48:44 +0100

Seen: 399 times

Last updated: Aug 23 '16