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_excel
from app.scodoc import sco_pdf from app.scodoc import sco_pdf
from app.scodoc import sco_xml from app.scodoc import sco_xml
from app.scodoc.sco_exceptions import ScoValueError
from app.scodoc.sco_pdf import SU from app.scodoc.sco_pdf import SU
from app import log 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()] # titles = ["<para><b>%s</b></para>" % x for x in self.get_titles_list()]
pdf_style_list = [] pdf_style_list = []
Pt = [ data_list = self.get_data_list(
[Paragraph(SU(str(x)), CellStyle) for x in line] pdf_mode=True,
for line in ( pdf_style_list=pdf_style_list,
self.get_data_list( with_titles=True,
pdf_mode=True, omit_hidden_lines=True,
pdf_style_list=pdf_style_list, )
with_titles=True, try:
omit_hidden_lines=True, 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 pdf_style_list += self.pdf_table_style
T = Table(Pt, repeatRows=1, colWidths=self.pdf_col_widths, style=pdf_style_list) T = Table(Pt, repeatRows=1, colWidths=self.pdf_col_widths, style=pdf_style_list)