[reportlab-users] Building Paragraph From Database Record

Rich Shepard rshepard at appl-ecosys.com
Mon Jul 2 13:50:58 EDT 2007


On Mon, 2 Jul 2007, Robin Becker wrote:


> In the latest paragraph you can use a <br/> tag to force a newline into

> the outcome. Normally Paragraphs treat all space characters the same ie as

> places for splitting or separating words. You shold be able to do


Robin,

Ah, of course! If I can use html tags for font attributes, I can use them
for spacing, too. Many thanks.


> Paragraph('<b>Head1</b>: text1<br/><b>Head2</b>: text2.....',style) etc and

> have the text laid out as you suggest. A typical way So I suspect you might

> want to do this like

>

> text = '<br/>.join(['<b>%s</b>: %s' % (label,self.data(aname))

> for label, aname in [

> ("Project name",'model_name'),

> ("Project description",'model_desc'),

> ("Project type", 'model_type'),

> ("Project owner", 'proj_owner'),

> ("Project location, 'proj_location'),

> ("Project state/province", 'proj_state'),

> ("Lead agency", 'lead_agency'),

> ("Knowledge engineers", 'keName'),

> ]

> ])


Much cleaner. There's still so much Python for me to learn.


> If you want a fixed space you should use &nbsp;


OK. That, too, is a good reminder.

Many thanks,

Rich

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863


More information about the reportlab-users mailing list