Next Line?

10 views
Skip to first unread message

Dan Gentry

unread,
Aug 16, 2010, 3:59:22 PM8/16/10
to geraldo-users
I think I'm missing something obvious. Although I've looked through
the docs and examples, I can't seem to find a good example for a multi-
line band. In my report, I've defined a ReportGroup like so:

groups = [
ReportGroup(attribute_name='b2c_class.id',
band_header=ReportBand(
height=.854*inch,
auto_expand_height = True,
elements=[
ObjectValue(attribute_name='class_name', left=0,
top=0.18*inch, width=BAND_WIDTH,
get_value=lambda instance:
str(instance.b2c_class.class_name),
style={'fontName': 'Helvetica-Bold',
'fontSize': 12, 'alignment': TA_CENTER}),
ObjectValue(attribute_name='session',
left=0.5*inch, top=0.36*inch, width=BAND_WIDTH,
get_value=lambda instance: 'Time: ' +
str((format_time_hm(instance.b2c_class.session.start_time) if
instance.b2c_class.session.start_time else '')
+ (' - ' +
format_time_hm(instance.b2c_class.session.stop_time) if
instance.b2c_class.session.stop_time else '')),
style={'fontName': 'Helvetica-Bold',
'fontSize': 9}),
ObjectValue(attribute_name='location',
left=3*inch, top=0.36*inch, width=BAND_WIDTH,
get_value=lambda instance: ('Location: ' +
str(instance.b2c_class.location)),
style={'fontName': 'Helvetica-Bold',
'fontSize': 9}),
],
borders={'bottom': True},
)
),
]

Works fine sometimes. However, if the class_name value needs more
than one line to print, it writes over the next line of text. Instead
of hard coding a top attribute value, I'd like to use something like
'next_line' or 'same_line' as needed that would take into account the
font height, amount of text, etc, used in the previous line or group.

Could someone steer me in the right direction?

Thanks,

Dan Gentry
Reply all
Reply to author
Forward
0 new messages