Generating a HTML document with a document template is proving to be very tricky. Where a PDF using the same template looks great and takes into consideration all styling applied, the HTML simply ignores all styling. For instance, text-align: right to right align an imageviewer contained in a table cell simply does not work. I also cannot seem to give a table a fixed width (in pixels or %), etc. etc. Why is this behaviour like this?
The HTML export is more used as a simple preview. The reason much of the styling disappears is because most of the HTML is rendered within a PRE tag which limits the amount of styling you can do. But unfortunately this tag is very much needed due to the need to preserve the text layout (linebreaks, tabs, multiple spaces etc. would go missing otherwise.)