[reportlab-users] How to truncate a paragraph

Andy Robinson andy at reportlab.com
Mon Sep 3 05:20:28 EDT 2012


There is a flowable called KeepInFrame in platypus/flowables.py.

You can 'wrap' this around content and specify one of four behaviours
if the content exceeds the available space:
error raise an error in the normal way
continue ignore ie just draw it and report maxWidth, maxHeight
shrink shrinkToFit
truncate fit as much as possible

Usage would be something like..

story.append(
KeepInFrame(myParagraph, mode='truncate')
)


Does this do what you need?

- Andy

On 3 September 2012 07:30, Sascha Boch <sascha.boch at gmx.de> wrote:

> Dear list,

>

> I need to create a document that has limited vertical space available for a paragraph of text. The content that the paragraph contains is entered by the users of the application and can be of any length. The problem is that I cannot find a way to display the text so that it is displayed in the available space. The part of the text that would not fit into the available space can be truncated.

>

> When I use the Paragrah object, it always shows all of the text. Table and Frame have a height attribute but that does not seem to do it's job for me either.

>

> Any idea what I can do to display a multi-line paragraph of text with a finite height attribute?

>

> Thanks & regards,

> Sascha

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users




--
Andy Robinson
Managing Director
ReportLab Europe Ltd.
Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK
Tel +44-20-8405-6420


More information about the reportlab-users mailing list