diff --git a/src/calibre/ebooks/docx/to_html.py b/src/calibre/ebooks/docx/to_html.py index ee5fb6d3d6..a41daae32e 100644 --- a/src/calibre/ebooks/docx/to_html.py +++ b/src/calibre/ebooks/docx/to_html.py @@ -671,8 +671,11 @@ class Convert: ctext = child.text if space != 'preserve': # Remove leading and trailing whitespace. Word ignores - # leading and trailing whitespace without preserve - ctext = ctext.strip(' \n\r\t') + # leading and trailing whitespace without preserve unless + # the element is only whitespace. + stripped = ctext.strip(' \n\r\t') + if stripped: + ctext = stripped # Only use a with white-space:pre-wrap if this element # actually needs it, i.e. if it has more than one # consecutive space or it has newlines or tabs.