How to remove table padding when using CLI -convert-to parameter in LibreOffice

I have a script that generates an HTML document, which is then converted to a .doc file using something like this:

libreoffice5.3 --headless --convert-to doc:"MS Word 97" input.html --outdir outputdir

      

I cannot set padding on table cells. They always end 0.5 cm at the bottom.

I tried adding CSS pages like "td {padding: 0cm;}" and tried adding CSS directly to the elements themselves and even tried adding cellpadding = 0 to the element.

I remember reading somewhere that it is possible to apply a predefined style to a document using a template filter, but I can't find an example of anyone who ever does this.

So my question is how to remove cell contents from tables when converting from HTML to Doc in LibreOffice.

+3


source to share


1 answer


Found.

When converting elements from HTML to Doc (or PDF, etc.) LibreOffice sets margins (not padding!) On table cells. This is not interesting since the margin should be outside the element, not inside.

To remove a space, just add it to your HTML:



<style>th,td{margin:0cm}</style>

      

LibreOffice needs the "cm" part because it doesn't understand that 0 is nothing at all 0 ...

+2


source







All Articles