[reportlab-users] Vertical Align in Tables With Large Fonts.

sp3ktr sp3ktr at gmail.com
Sat Dec 4 01:05:38 EST 2004


On Fri, 3 Dec 2004 10:24:09 -0800, jpywtora at calpoly.edu
<jpywtora at calpoly.edu> wrote:
 
> If the contents are not in a Paragraph flowable, try using one.  Assuming this
> is a text cell.  

They are text cells.  I tried it with a Paragraph object but to no avail.

> Outside of this more than likely would need to see a small code snippet.

Here is a quick example. In the pdf, both the text cells and the
Paragraph flowable still sit to the bottom of the fields (i'm assuming
the VALIGN directive in the table cell should align the whole
Paragraph object?):

from reportlab.platypus import Table,TableStyle,SimpleDocTemplate
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
from reportlab.platypus.paragraph import Paragraph

styleSheet = getSampleStyleSheet()

lst = []

data = (('Nov', 'Dec'),('Nov', Paragraph('<font
size="20">test</font>',styleSheet['Normal'])))
t1 = Table(data,(200,200),(40))
sty = TableStyle([
			('GRID',(0,0),(-1,-1),1,colors.red),
			('VALIGN',(0,0),(-1,-1),'MIDDLE'),
			('SIZE',(0,0),(-1,-1),20)])
t1.setStyle(sty)
lst.append(t1)

SimpleDocTemplate('test_table_layout.pdf').build(lst)

btw tried this code on both mac 10.3 and win32 xp.

-- 
adieu
sp3ktr


More information about the reportlab-users mailing list