From d6c3a1b1e193b6e54a9dd15b10670959c2bba4c1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 31 Aug 2016 20:01:57 +0530 Subject: [PATCH] DOCX Output: Ignore invalid text-indent values in the input document instead of erroring out. Fixes #1618869 [EPUB to DOCX conversion fails](https://bugs.launchpad.net/calibre/+bug/1618869) --- src/calibre/ebooks/docx/writer/styles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/docx/writer/styles.py b/src/calibre/ebooks/docx/writer/styles.py index d2c7455a17..deeb0fa46a 100644 --- a/src/calibre/ebooks/docx/writer/styles.py +++ b/src/calibre/ebooks/docx/writer/styles.py @@ -485,8 +485,12 @@ class BlockStyle(DOCXStyle): self.background_color = None self.text_align = 'left' else: - self.text_indent = int(css['text-indent'] * 20) - self.css_text_indent = css._get('text-indent') + try: + self.text_indent = int(css['text-indent'] * 20) + self.css_text_indent = css._get('text-indent') + except (TypeError, ValueError): + self.text_indent = 0 + self.css_text_indent = None try: self.line_height = max(0, int(css.lineHeight * 20)) except (TypeError, ValueError):