Libreoffice CSS for HTML?

1

I'm trying to convert a Docx file to HTML for eventual publishing as a web page. Libreoffice does a pretty good job converting the Docx file to HTML. When viewing the HTML in Libreoffice, it looks almost identical to the original Docx. However, when I view it via Chrome or Firefox, it looks terrible, like most of the CSS is missing. Margins and padding are all wrong, and font sizes are the browser defaults.

Why is this? Looking at the generated HTML, there are no external stylesheets used, and nearly all the styling is inline, so it should contain everything needed to properly display it. Is there a stylesheet implicitly being used when loaded into Libreoffice that isn't used in a web browser?

Cerin

Posted 2018-07-18T18:39:04.050

Reputation: 6 081

1

Would be best if you could show a small sample document (original, perhaps a screenshot, and the resulting HTML), with which others could reproduce the issue. Also, it seems like a bit of an XY problem — why begin with a Word document when you want to end up with a website? Pandoc may help you in converting the document to a sane HTML for which you could specify your own CSS. Or just have people write the document in a language that only specifies semantics (e.g., Markdown), then convert it later.

– slhck – 2018-07-18T18:50:29.890

Answers

1

LibreOffice probably renders HTML using default style settings that are more attractive than your web browser's defaults. I don't really see what other explanation there could be.

Paul T.

Posted 2018-07-18T18:39:04.050

Reputation: 41