@@ -258,10 +258,12 @@ def export_footnote(self, footnote):
258258 return tag .apply (results , allow_empty = False )
259259
260260 def get_paragraph_tag (self , paragraph ):
261- if self .in_table_cell and paragraph .parent .properties .is_continue_vertical_merge :
262- # We ignore such paragraphs here because are added via rowspan
263- return
264- elif paragraph .is_empty :
261+ if isinstance (paragraph .parent , wordprocessing .TableCell ):
262+ cell_properties = paragraph .parent .properties
263+ if cell_properties and cell_properties .is_continue_vertical_merge :
264+ # We ignore such paragraphs here because are added via rowspan
265+ return
266+ if paragraph .is_empty :
265267 return HtmlTag ('p' , custom_text = HTML_WHITE_SPACE )
266268
267269 heading_style = paragraph .heading_style
@@ -291,7 +293,7 @@ def export_paragraph(self, paragraph):
291293 tag = self .get_paragraph_tag (paragraph )
292294 if tag :
293295 attrs = self .get_paragraph_styles (paragraph )
294- tag .attrs = attrs
296+ tag .attrs . update ( attrs )
295297 results = tag .apply (results )
296298
297299 for result in results :
@@ -345,6 +347,11 @@ def get_paragraph_property_spacing(self, paragraph):
345347 if self .first_pass :
346348 return style
347349
350+ try :
351+ current_par_index = self .paragraphs .index (paragraph )
352+ except ValueError :
353+ return style
354+
348355 previous_paragraph = None
349356 next_paragraph = None
350357 previous_paragraph_spacing = None
@@ -353,7 +360,6 @@ def get_paragraph_property_spacing(self, paragraph):
353360 spacing_before = None
354361
355362 current_paragraph_spacing = paragraph .get_spacing ()
356- current_par_index = self .paragraphs .index (paragraph )
357363
358364 if current_par_index > 0 :
359365 previous_paragraph = self .paragraphs [current_par_index - 1 ]
0 commit comments