diff --git a/src/calibre/ebooks/docx/settings.py b/src/calibre/ebooks/docx/settings.py index 193c5bd3cb09..be85fb9f5e05 100644 --- a/src/calibre/ebooks/docx/settings.py +++ b/src/calibre/ebooks/docx/settings.py @@ -10,8 +10,10 @@ class Settings(object): - def __init__(self, root): + def __init__(self): self.default_tab_stop = 720 / 20 + + def __call__(self, root): for dts in XPath('//w:defaultTabStop[@w:val]')(root): try: self.default_tab_stop = int(get(dts, 'w:val')) / 20 diff --git a/src/calibre/ebooks/docx/to_html.py b/src/calibre/ebooks/docx/to_html.py index fa414b9503fb..c6b2e230d4a6 100644 --- a/src/calibre/ebooks/docx/to_html.py +++ b/src/calibre/ebooks/docx/to_html.py @@ -55,6 +55,7 @@ def __init__(self, path_or_stream, dest_dir=None, log=None, detect_cover=True, n self.mi = self.docx.metadata self.body = BODY() self.theme = Theme() + self.settings = Settings() self.tables = Tables() self.fields = Fields() self.styles = Styles(self.tables) @@ -267,7 +268,7 @@ def get_name(rtype, defname): except KeyError: self.log.warn('Settings %s do not exist' % sename) else: - self.settings = Settings(fromstring(seraw)) + self.settings(fromstring(seraw)) if foname is not None: try: