Skip to content
Snippets Groups Projects
Commit a7a82c55 authored by Alexis Filipozzi's avatar Alexis Filipozzi
Browse files

center image only out of table

parent 956bfd67
Branches
No related tags found
No related merge requests found
Pipeline #
......@@ -32,17 +32,19 @@ class Image:
img.attrib["height"] = self._height
return img
def to_element(self, tag_name="element"):
def to_element(self, tag_name="element", is_in_table=False):
el = etree.Element(tag_name)
layout = etree.Element("layout")
layout.attrib["secondary_alignment"] = "CENTER"
layout.attrib["gap"] = "0"
layout.attrib["fit_content_height"] = "true"
if not is_in_table:
el.append(layout)
top_mg = etree.Element("top_margin")
top_mg.text = "20"
layout.append(top_mg)
if not is_in_table:
size = etree.Element("size")
size.attrib["relative_width"] = "1"
layout.append(size)
......@@ -59,6 +61,9 @@ class Image:
inner_el.append(inner_layout)
inner_el.append(self.to_xml())
else:
el.append(layout)
el.append(self.to_xml())
return el
......@@ -195,7 +200,7 @@ class Table:
if isinstance(cell, Image):
cell_xml = etree.Element("cell")
table.append(cell_xml)
cell_xml.append(cell.to_element("element"))
cell_xml.append(cell.to_element("element", True))
else:
table.append(cell.to_element("cell"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment