How to "save as" or "save a copy" via API (non-GUI)? I need to save as html, since html export looks bad

Hello,

since an export as html looks bad (for example table of contents only numbers), I did save a copy as html, which results in an acceptable output.
Now I want to automatize it, to do it without the LibreOffice GUI.
How to do so?

Thanks and best regards
Simon

try on commandline:

soffice --help

and look for the --convert-to … Arguments

No, as I said, exporting to html leads to an ugly result, the table of content has only numbers with links but no chapter/section headings.

I need “save as” or “save a copy” and then select html.