diff --git a/htmldocx/h2d.py b/htmldocx/h2d.py index 6a0e113..a5225fe 100644 --- a/htmldocx/h2d.py +++ b/htmldocx/h2d.py @@ -419,7 +419,10 @@ def handle_starttag(self, tag, attrs): self.tags['list'].append(tag) return # don't apply styles for now elif tag == 'br': - self.run.add_break() + try: + self.run.add_break() + except AttributeError: #If
is the first element parsed, self.run will not be defined + self.doc.add_paragraph() return self.tags[tag] = current_attrs