[reportlab-users] Newbie -- How to center text in a paragraph

Jim Steil jim at qlf.com
Thu Jun 22 14:25:21 EDT 2006


Hi:

 

I'm REAL new to reportlab and am trying to center my text in a paragraph.
I've found the XML markup and have the following code:

 

    styles = getSampleStyleSheet()

    style = styles['Normal']

    s5Text1 = '<para alignment="1"><i><b>QLF PRESERVATIVES AND MOLD
INHIBITORS</b></i></para>'

    section5P1 = Paragraph(s5Text1, style)

    story5 = []

    story5.append(section5P1)

    frame5.addFromList(story5, canvas)

 

And here is the error I'm getting:

 

Traceback (most recent call last):

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript

    exec codeObject in __main__.__dict__

  File "C:\svn\Python Misc\priceListN.py", line 251, in ?

    processPlant(plant, priceList, priceListDate)

  File "C:\svn\Python Misc\priceListN.py", line 190, in processPlant

    printBacker(canvas, plantNumber)

  File "C:\svn\Python Misc\priceListN.py", line 228, in printBacker

    section5P1 = Paragraph(s5Text1, style)

  File "C:\Python24\reportlab\platypus\paragraph.py", line 445, in __init__

    self._setup(text, style, bulletText, frags, cleanBlockQuotedText)

  File "C:\Python24\reportlab\platypus\paragraph.py", line 469, in _setup

    raise "xml parser error (%s) in paragraph beginning\n'%s'"\

xml parser error (alignment: invalid value 1) in paragraph beginning

'<para alignment="1"><i><b>QLF '

 

I'm obviously missing the boat on something here but I can't seem to find
it.  Any help would really be appreciated.

 

            -Jim

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060622/54338f8d/attachment.htm


More information about the reportlab-users mailing list