[reportlab-users] cjk-word-wrapping and xml-character-entities

Gábor Farkas gabor at nekomancer.net
Wed Nov 19 08:31:58 EST 2008


the following script fails:

from reportlab.platypus import SimpleDocTemplate, Paragraph
from reportlab.lib.styles import ParagraphStyle

doc = SimpleDocTemplate("test.pdf")

p = Paragraph(u'aaaa',ParagraphStyle('s',wordWrap='CJK'))
story = [p]

please note, that "a" is simply "a", so the text in the paragraph
is simply "aaaa".
the problem is a combination of 2 issues:

1. the CJK algorithm only handles paragraps with 1 ParaFrags
2. the ParaParser, when parses the text, creates 2 frags because of
the char-entity

is there any way to work around this problem?

of course, my real problem is with chinese text. chinese text with
"&" in it,
to be precise. this problem makes it impossible for me to have that
text word-wrapped
or, maybe, is there a way to represent "&" in a paragraph in a different way?
in one that does not cause the ParaParser to create new ParaFrags?


More information about the reportlab-users mailing list