I found a solution.
The following macro (found here : http://www.oooforum.org/forum/viewtopic.phtml?t=60539) does the job :
Sub OptimzeColumnWidth
Dim s As String
Dim i As Long
Dim oTables
Dim oTable
Dim oCell
oTables = ThisComponent.getTextTables()
If NOT oTables.hasElements() Then Exit Sub
For i = 0 To oTables.getCount() - 1
oTable = oTables.getByIndex(i)
ThisComponent.getCurrentController().select(oTable)
oFrame = ThisComponent.CurrentController.Frame
oDispHelper = createUnoService("com.sun.star.frame.DispatchHelper")
oDispHelper.executeDispatch(oFrame, ".uno:SelectTable", "", 0, Array())
oDispHelper.executeDispatch(oFrame, ".uno:SetOptimalColumnWidth", "", 0, Array())
Next
End Sub
If I save the macro in a library in “my macros”, I can run it from the command line like that:
libreoffice "macro:///FormatPandocOdt.Module1.OptimzeColumnWidth" myfile.odt
But I would like to have the macro saved in a library within the document (not in my macros but in myfile.odt in the macro hierarchy) and I had to do this to make it work :
libreoffice "macro://./Standard.FormatPandocOdt.OptimzeColumnWidth" myfile.odt
With my security options (middle), libroffice open and ask if I want to activate the macros within the document.