allows Paragraph in table cells for pdf, and specific cell values for pdf

This commit is contained in:
Emmanuel Viennet 2022-03-09 13:59:40 +01:00
parent a4035411d9
commit d2fe27b67c

View File

@ -233,6 +233,9 @@ class GenTable(object):
colspan_count -= 1
# if colspan_count > 0:
# continue # skip cells after a span
if pdf_mode:
content = row.get(f"_{cid}_pdf", "") or row.get(cid, "") or ""
else:
content = row.get(cid, "") or "" # nota: None converted to ''
colspan = row.get("_%s_colspan" % cid, 0)
if colspan > 1:
@ -547,9 +550,16 @@ class GenTable(object):
omit_hidden_lines=True,
)
try:
Pt = [
[Paragraph(SU(str(x)), CellStyle) for x in line] for line in data_list
Pt = []
for line in data_list:
Pt.append(
[
Paragraph(SU(str(x)), CellStyle)
if (not isinstance(x, Paragraph))
else x
for x in line
]
)
except ValueError as exc:
raise ScoPDFFormatError(str(exc)) from exc
pdf_style_list += self.pdf_table_style