(self)
| 34 | ] |
| 35 | |
| 36 | def test_document(self): |
| 37 | |
| 38 | rowheights = (24, 16, 16, 16, 16) |
| 39 | rowheights2 = (24, 16, 16, 16, 30) |
| 40 | colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) |
| 41 | GRID_STYLE = TableStyle( |
| 42 | [('GRID', (0,0), (-1,-1), 0.25, colors.black), |
| 43 | ('ALIGN', (1,1), (-1,-1), 'RIGHT')] |
| 44 | ) |
| 45 | |
| 46 | styleSheet = getSampleStyleSheet() |
| 47 | styNormal = styleSheet['Normal'] |
| 48 | styNormal.spaceBefore = 6 |
| 49 | styNormal.spaceAfter = 6 |
| 50 | |
| 51 | data = ( |
| 52 | ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), |
| 53 | ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), |
| 54 | ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), |
| 55 | ('Miscellaneous accessories', 0,0,0,0,0,0,1,0,0,0,2,13), |
| 56 | ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') |
| 57 | ) |
| 58 | data2 = ( |
| 59 | ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), |
| 60 | ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), |
| 61 | ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), |
| 62 | ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), |
| 63 | ('Hats\nLarge', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') |
| 64 | ) |
| 65 | |
| 66 | |
| 67 | data3 = ( |
| 68 | ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), |
| 69 | ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), |
| 70 | ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), |
| 71 | ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), |
| 72 | (Paragraph("Let's <b>really mess things up with a <i>paragraph</i>",styNormal), |
| 73 | 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') |
| 74 | ) |
| 75 | |
| 76 | lst = [] |
| 77 | |
| 78 | |
| 79 | lst.append(Paragraph("""Basics about column sizing and cell contents""", styleSheet['Heading1'])) |
| 80 | |
| 81 | t1 = Table(data, colwidths, rowheights) |
| 82 | t1.setStyle(GRID_STYLE) |
| 83 | lst.append(Paragraph("This is GRID_STYLE with explicit column widths. Each cell contains a string or number\n", styleSheet['BodyText'])) |
| 84 | lst.append(t1) |
| 85 | lst.append(Spacer(18,18)) |
| 86 | |
| 87 | t2 = Table(data, None, None) |
| 88 | t2.setStyle(GRID_STYLE) |
| 89 | lst.append(Paragraph("""This is GRID_STYLE with no size info. It |
| 90 | does the sizes itself, measuring each text string |
| 91 | and computing the space it needs. If the text is |
| 92 | too wide for the frame, the table will overflow |
| 93 | as seen here.""", |
nothing calls this directly
no test coverage detected