[reportlab-users] Disable XML parsing in Paragraph(..)

Robin Becker reportlab-users@reportlab.com
Wed, 07 Jul 2004 08:30:37 +0100


Allan Michael Cuenca wrote:

> I'm attempting to generate PDF files on the fly with a text widget with
> contents sent to a platypus cgi. I don't need the xml paragraph formatting
> markup feature. How do I disable this feature?
> 
> I need the wrapping feature but not the xml formatting, so that leaves out
> Preformatted. I could create a new class by inheriting from both but how do
> I best go about getting a simple, non-parsing Paragraph object.
> 
> Allan Michael Cuenca
> Systems / Database Administrator
> BakeMark Ingredients Canada, Ltd.
> (604) 303-1700 Ext 241
> DID: (604) 303-1741
> 

......

effectively you'll need to replace the line

style, frags, bulletTextFrags = _parser.parse(text,style)

in the paragraph _setup method.


The style remains at the argument value and bulletTextFrags is 
effectively None.

To create the single frag
	from paraparser import ParaFrag
	frag = ParaFrag()
	frag.fontName = style.fontName
	frag.fontSize = style.fontSize
	frag.text = text

	frags = [frag]



-- 
Robin Becker