Changeset 10567 for main/waeup.kofa
- Timestamp:
- 30 Aug 2013, 07:39:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py
r10565 r10567 70 70 from reportlab.lib.units import cm 71 71 from reportlab.platypus import Paragraph, Table, Spacer 72 from reportlab.platypus.flowables import Flowable 72 73 from waeup.kofa.reports import IReport, IReportGenerator 73 74 from waeup.kofa.reports import Report … … 77 78 STYLE = getSampleStyleSheet() 78 79 80 class TTR(Flowable): #TableTextRotate 81 '''Rotates a text in a table cell.''' 82 83 def __init__(self, text): 84 Flowable.__init__(self) 85 self.text=text 86 87 def draw(self): 88 canvas = self.canv 89 canvas.rotate(45) 90 canvas.drawString( 0, -1, self.text) 91 92 #def wrap(self,aW,aH): 93 # canv = self.canv 94 # return canv._leading, canv.stringWidth(self.text) 95 79 96 def tbl_data_to_table(data): 80 97 result = [] 81 new_col_names = ('Student Id', _('Matric No.'), _('Name'),82 _('Total Credits'), _('Total Credits Passed'),83 _('GPA'), _('Courses Failed'))84 table = [ new_col_names]98 col_names = ('Student Id', 'Matric No.', 'Name', 99 TTR('Total Credits'), TTR('Total Credits Passed'), 100 'GPA', 'Courses Failed') 101 table = [col_names] 85 102 for line in data: 86 103 table.append(line) … … 89 106 TABLE_STYLE = [ 90 107 ('FONT', (0,0), (-1,-1), 'Helvetica', 8), 91 ('FONT', (0,0), (0,-1), 'Helvetica-Bold', 8),92 ('FONT', (0,0), (-1,0), 'Helvetica-Bold', 8), 93 ('FONT', (0,-1), (-1,-1), 'Helvetica-Bold', 8),94 ('FONT', (-1,0), (-1,-1), 'Helvetica-Bold', 8),108 #('FONT', (0,0), (0,-1), 'Helvetica-Bold', 8), # 1st column 109 ('FONT', (0,0), (-1,0), 'Helvetica-Bold', 8), # 1st row 110 #('FONT', (0,-1), (-1,-1), 'Helvetica-Bold', 8), # last row 111 #('FONT', (-1,0), (-1,-1), 'Helvetica-Bold', 8), # last column 95 112 ('ALIGN', (1,1), (-1,-1), 'RIGHT'), 96 ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black), 97 ('LINEBELOW', (0,-1), (-1,-1), 0.25, colors.black), 98 ('LINEAFTER', (-1,0), (-1,-1), 0.25, colors.black), 99 ('LINEBEFORE', (-1,0), (-1,-1), 1.0, colors.black), 100 #('LINEABOVE', (0,-1), (-1,-1), 1.0, colors.black), 101 #('LINEABOVE', (0,0), (-1,0), 0.25, colors.black), 102 ('BOX', (0,0), (-1,-1), 1, colors.black), 113 ('ALIGN', (2,0), (2,-1), 'LEFT'), 114 ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), 115 ('BOX', (0,1), (-1,-1), 1, colors.black), 103 116 ] 104 117 … … 140 153 Spacer(1, 12),] 141 154 pdf_data += [ 142 Table(table_data, style=TABLE_STYLE)] 155 Table(table_data, style=TABLE_STYLE)] #, colWidths=col_widths)] 143 156 doc_title = 'Level Report' 144 157 pdf = creator.create_pdf(
Note: See TracChangeset for help on using the changeset viewer.