[FIX]Docx Report Generation : needs tail to add not surrouneded data
This commit is contained in:
parent
cf23e0df8d
commit
71b7b19caa
@ -14,7 +14,7 @@
|
|||||||
"author": "RYDLAB, Yaltik",
|
"author": "RYDLAB, Yaltik",
|
||||||
"website": "https://rydlab.ru",
|
"website": "https://rydlab.ru",
|
||||||
"category": "Technical",
|
"category": "Technical",
|
||||||
"version": "16.0.2.1.1",
|
"version": "16.0.2.1.2",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"depends": ["base", "web", "custom_report_field", "report_monetary_helpers"],
|
"depends": ["base", "web", "custom_report_field", "report_monetary_helpers"],
|
||||||
"external_dependencies": {"python": ["docxcompose", "docxtpl", "beautifulsoup4"]},
|
"external_dependencies": {"python": ["docxcompose", "docxtpl", "beautifulsoup4"]},
|
||||||
|
@ -457,20 +457,21 @@ class IrActionsReport(models.Model):
|
|||||||
'ol', 'li', 'font', 'a'):
|
'ol', 'li', 'font', 'a'):
|
||||||
if child.tag == 'p':
|
if child.tag == 'p':
|
||||||
p = md.add_paragraph(child.text)
|
p = md.add_paragraph(child.text)
|
||||||
|
p.add_run(child.tail)
|
||||||
elif child.tag == 'a':
|
elif child.tag == 'a':
|
||||||
p.add_run(child.text).style = 'Hyperlink'
|
p.add_run(child.text).style = 'Hyperlink'
|
||||||
elif child.tag == 'strong':
|
elif child.tag == 'strong':
|
||||||
p.add_run(child.text).bold = True
|
p.add_run(child.text).bold = True
|
||||||
p.add_run(' ')
|
p.add_run(child.tail)
|
||||||
elif child.tag == 'em':
|
elif child.tag == 'em':
|
||||||
p.add_run(child.text).italic = True
|
p.add_run(child.text).italic = True
|
||||||
p.add_run(' ')
|
p.add_run(child.tail)
|
||||||
elif child.tag == 'u':
|
elif child.tag == 'u':
|
||||||
p.add_run(child.text).underline = True
|
p.add_run(child.text).underline = True
|
||||||
p.add_run(' ')
|
p.add_run(child.tail)
|
||||||
elif child.tag == 's':
|
elif child.tag == 's':
|
||||||
p.add_run(child.text).font.strike = True
|
p.add_run(child.text).font.strike = True
|
||||||
p.add_run(' ')
|
p.add_run(child.tail)
|
||||||
elif child.tag == 'font' and 'style' in child.attrib:
|
elif child.tag == 'font' and 'style' in child.attrib:
|
||||||
if 'color' in child.get('style'):
|
if 'color' in child.get('style'):
|
||||||
rgb = [int(_v)
|
rgb = [int(_v)
|
||||||
@ -479,6 +480,7 @@ class IrActionsReport(models.Model):
|
|||||||
p.add_run(child.text).font.color.rgb = RGBColor(*rgb)
|
p.add_run(child.text).font.color.rgb = RGBColor(*rgb)
|
||||||
else:
|
else:
|
||||||
p.add_run(child.text)
|
p.add_run(child.text)
|
||||||
|
p.add_run(child.tail)
|
||||||
elif child.tag == 'ul':
|
elif child.tag == 'ul':
|
||||||
list_type = '9' # 9/25/28 : •, 8 : -, 19 : v
|
list_type = '9' # 9/25/28 : •, 8 : -, 19 : v
|
||||||
elif child.tag == 'ol':
|
elif child.tag == 'ol':
|
||||||
@ -490,6 +492,7 @@ class IrActionsReport(models.Model):
|
|||||||
continue
|
continue
|
||||||
else: # Not handled, add text only
|
else: # Not handled, add text only
|
||||||
p.add_run(child.text)
|
p.add_run(child.text)
|
||||||
|
p.add_run(child.tail)
|
||||||
return md
|
return md
|
||||||
return field
|
return field
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user