Ignore:
Timestamp:
10 Jul 2018, 13:55:56 (6 years ago)
Author:
Henrik Bettermann
Message:

Optimize column widths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_payment_statistics.py

    r14610 r15081  
    155155    new_col_names = []
    156156    for name in col_names:
    157         if len(name) > 18:
    158             new_col_names.append(name.replace(' ', '\n', 1))
    159         else:
    160             new_col_names.append(name)
     157        new_col_names.append(name.replace(' ', '\n'))
    161158    head = [''] + [col_name for col_name in new_col_names]
    162159    result = [head]
     
    244241    def create_pdf(self, job_id):
    245242        creator = getUtility(IPDFCreator, name=self.pdfcreator)
     243        maxlength = len(str(self.data[2][-1][-1])) \
     244            + len(str(self.data[2][-1][-2])) \
     245            + 3
     246        maxlength = max(maxlength, 10)
    246247        table_data = tbl_data_to_table(*self.data)
    247         col_widths = [None,] + [3.2*cm] * len(self.data[1]) + [None,]
     248        col_widths = [None,] + [.17*cm*maxlength] * len(self.data[1]) + [None,]
    248249        pdf_data = [Paragraph('<b>%s - Report %s</b>'
    249250                              % (self.creation_dt_string, job_id),
Note: See TracChangeset for help on using the changeset viewer.