[reportlab-users] (no subject)
Yuan HOng
hongyuan1306 at gmail.com
Tue Jun 5 09:56:24 EDT 2007
Hallo Stefan,
I just discovered z3c.rml for my project and find it a great product.
In using it in my project, I made the following improvements to your
code, and hope this will be useful for others.
1. I am creating Chinese PDF documents. The normal TTF for Chinese
printing is 'simsun'. However, when we want to have bold in text, we
switch to 'simhei'. To properly registered this, we need
reportlab.lib.fonts.addMapping function. This is missing in the
reportlab RML specification, and I added the directive as:
<addMapping faceName="simsun" bold="1" italic="0" psName="simhei" />
2. Chinese and some other Asian text does not use space as word
separator, so the default paragraph wrapping doesn't work for them. To
correct this, reportlab 2.0 introduced the 'wordWrap' attribute to
'para' and 'paraStyle' directive. When set to 'CJK', it will cause the
CJK wrapping algorithm to be used.
3. I can't find a way to left align the whole table in a frame.
Reading the reportlab user guide I find the following:
All flowables have an hAlign property: ('LEFT', 'RIGHT', 'CENTER' or
'CENTRE'). For
paragraphs, which fill the full width of the frame, this has no
effect. For tables, images or other objects which
are less than the width of the frame, this determines their horizontal
placement.
So a <blockTable> should also support the 'alignment' attribute, just
like a <para>. I added this, and it worked.
Attached please find the svn diff output of my modifications against
the current SVN trunk.
By the way, is <pageNumber> and other sequence tags working? I can't
get them working.
--
Hong Yuan
大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
More information about the reportlab-users
mailing list