author | rgbecker |
Wed, 25 Oct 2000 08:57:46 +0000 | |
changeset 494 | 54257447cfe9 |
parent 356 | 377367fe28cb |
permissions | -rwxr-xr-x |
6 | 1 |
#!/bin/env python |
494 | 2 |
#copyright ReportLab Inc. 2000 |
3 |
#see license.txt for license details |
|
4 |
#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/platypus/test/testtables.py?cvsroot=reportlab |
|
5 |
#$Header: /tmp/reportlab/reportlab/platypus/test/Attic/testtables.py,v 1.12 2000/10/25 08:57:46 rgbecker Exp $ |
|
6 |
__version__=''' $Id: testtables.py,v 1.12 2000/10/25 08:57:46 rgbecker Exp $ ''' |
|
16 | 7 |
__doc__='Test script for reportlab.tables' |
253 | 8 |
from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle |
42
ba8c232f544e
Moved inch and cm definitions to reportlab.lib.units and amended all demos
andy_robinson
parents:
16
diff
changeset
|
9 |
from reportlab.lib.units import inch |
168
02bac1346c69
Tables changed to use reportlab.lib.colors instead of
andy_robinson
parents:
42
diff
changeset
|
10 |
from reportlab.lib import colors |
02bac1346c69
Tables changed to use reportlab.lib.colors instead of
andy_robinson
parents:
42
diff
changeset
|
11 |
|
6 | 12 |
def getTable(): |
356 | 13 |
t = Table((('','North','South','East','West'), |
0 | 14 |
('Quarter 1',100,200,300,400), |
15 |
('Quarter 2',100,400,600,800), |
|
356 | 16 |
('Total',300,600,900,'1,200')), |
17 |
(72,36,36,36,36), |
|
18 |
(24, 16,16,18) |
|
6 | 19 |
) |
0 | 20 |
return t |
6 | 21 |
|
22 |
def makeStyles(): |
|
23 |
styles = [] |
|
24 |
for i in range(5): |
|
253 | 25 |
styles.append(TableStyle([('ALIGN', (1,1), (-1,-1), 'RIGHT'), |
6 | 26 |
('ALIGN', (0,0), (-1,0), 'CENTRE') ])) |
27 |
for style in styles[1:]: |
|
168
02bac1346c69
Tables changed to use reportlab.lib.colors instead of
andy_robinson
parents:
42
diff
changeset
|
28 |
style.add('GRID', (0,0), (-1,-1), 0.25, colors.black) |
6 | 29 |
for style in styles[2:]: |
168
02bac1346c69
Tables changed to use reportlab.lib.colors instead of
andy_robinson
parents:
42
diff
changeset
|
30 |
style.add('LINEBELOW', (0,0), (-1,0), 2, colors.black) |
6 | 31 |
for style in styles[3:]: |
168
02bac1346c69
Tables changed to use reportlab.lib.colors instead of
andy_robinson
parents:
42
diff
changeset
|
32 |
style.add('LINEABOVE', (0, -1), (-1,-1), 2, colors.black) |
6 | 33 |
styles[-1].add('LINEBELOW',(1,-1), (-1, -1), 2, (0.5, 0.5, 0.5)) |
0 | 34 |
return styles |
6 | 35 |
|
36 |
def run(): |
|
255 | 37 |
doc = SimpleDocTemplate('testtables.pdf', pagesize=(8.5*inch, 11*inch), showBoundary=1) |
6 | 38 |
styles = makeStyles() |
39 |
lst = [] |
|
40 |
for style in styles: |
|
41 |
t = getTable() |
|
42 |
t.setStyle(style) |
|
43 |
## print '--------------' |
|
44 |
## for rowstyle in t._cellstyles: |
|
45 |
## for s in rowstyle: |
|
46 |
## print s.alignment |
|
47 |
lst.append(t) |
|
225 | 48 |
lst.append(Spacer(0,12)) |
6 | 49 |
doc.build(lst) |
50 |
||
51 |
run() |
|
52 |
||
53 |
#LINEABOVE |
|
54 |
#LINEBELOW |
|
55 |
#LINEBEFORE |
|
56 |
#LINEAFTER |
|
57 |
#GRID |
|
58 |
#BOX |
|
59 |
#INNERGRID ?? |
|
60 |
||
61 |
#FONT |
|
62 |
#TEXTCOLOR |
|
63 |
#ALIGNMENT |
|
64 |
#PADDING |