Microsoft does not recommend or support server-side Automation of Office
I have given up trying with MS Office and am now using LibreOffice. This worked immediately and without any problems. I can't see any difference in the quality of our documents compared to documents exported with MS Office.
soffice --headless --convert-to pdf --outdir $ExportFolder $DocPath