[reportlab-users] set default unit possible ?

Andy Robinson reportlab-users@reportlab.com
Wed, 11 Dec 2002 21:00:18 -0000


> Is it possible to set a default unit with a stylesheet ?
> 
> It's a bit of a hassle to append * mm/cm/inch to every value that 
> needs a unit in parsing an xml file with paragraphs. 

No it isn't at the moment.  In our 'Report Markup Language'
product, we allow people to do things like 16cm, 2in etc.
by having a function 'readLength' which is applied to
many tags and their attributes. But if no units are given
then it is assumed to be in points.  IMHO this is reasonable.

It should be easy for you to subclass paragraph and insert
a one-line 'hook' after the XML is parsed and before anything
is done with it, and then iterate over all tags converting
relevant attributes by a conversion factor.

Best Regards,

Andy Robinson