Updating table of contents TOC with command line

Hi,
I was trying to refresh (update) the table of contents (index) of a “docx” file using command line “libreoffice --headless …” before converting it to pdf,
is this possible ?
Thank you

Hello,

this is not possible - --convert-to is designed to convert a document as close as possible to the originating document. There are no means to change a document during conversion.

The only way would be a two step procedure:

  • Change your document using a macro (which could be called using command line - see libreoffice --help)
  • Convert the changed document using --convert-to pdf

Thank you for your response,
I was not talking about doing it in the --convert-to command, I want to update the toc before converting it to pdf, and that was the question,
how to do it with a macro ?
I changed the code of the main function in the file ~/.config/libreoffice/4/user/basic/Standard/Module1.xba
by adding print "test"
Then, I called it with libreoffice --headless "macro:///Standard.Module1.main"
the cursor blinks without any response until I stop it with “Ctrl+C”
Can you tell me please how to execute this macro with command line ?