NOTE that libreoffice is a huge software package and thus highly vulnerable. I would certainly not recommend this setup for a public gitea instance where arbitrary users can upload documents!
Gitea can use external renderers to transform any file into html and then display this html. This aproach is nice, but it tends to get into trouble when the file you want to display has graphically complex content.
Libreoffice can convert quite a lot of filetypes to html, but the results are not all that convincing when it comes to graphical content.
So we use a different aproach. Use libreoffice to convert the file to pdf and then use pdftocairo to turn the files to svg and combine the svgs into a html file for gitea to display.
Install libreoffice and poppler
apt install libreoffice poppler-utils
Update your /etc/gitea/app.ini
and add the /usr/local/bin/lo2pdf2svg2html.sh
script and make it executable
chmod 755 /usr/local/bin/lo2pdf2svg2html.sh
That worked well. Thanks!