1
0
forked from ScoDoc/ScoDoc

geb_tables: meilleur msg erreur si template pdf invalide

This commit is contained in:
Emmanuel Viennet 2022-01-13 21:13:09 +01:00
parent a5c0619102
commit ec108a4454

View File

@ -58,6 +58,7 @@ from app.scodoc import sco_utils as scu
from app.scodoc import sco_excel
from app.scodoc import sco_pdf
from app.scodoc import sco_xml
from app.scodoc.sco_exceptions import ScoValueError
from app.scodoc.sco_pdf import SU
from app import log
@ -539,17 +540,18 @@ class GenTable(object):
#
# titles = ["<para><b>%s</b></para>" % x for x in self.get_titles_list()]
pdf_style_list = []
Pt = [
[Paragraph(SU(str(x)), CellStyle) for x in line]
for line in (
self.get_data_list(
data_list = self.get_data_list(
pdf_mode=True,
pdf_style_list=pdf_style_list,
with_titles=True,
omit_hidden_lines=True,
)
)
try:
Pt = [
[Paragraph(SU(str(x)), CellStyle) for x in line] for line in data_list
]
except ValueError as exc:
raise ScoValueError(f"Erreur dans un format pdf: <br/>{str(exc)}") from exc
pdf_style_list += self.pdf_table_style
T = Table(Pt, repeatRows=1, colWidths=self.pdf_col_widths, style=pdf_style_list)