[reportlab-users] How to indent entire paragraphs

Saketh saketh.bhamidipati at gmail.com
Sun Nov 19 16:37:02 EST 2006


On 11/19/06, Andy Robinson <andy at reportlab.com> wrote:

>

> Saketh wrote:

> > Using Platypus, I insert Paragraphs into my story. I need to indent

> > these paragraphs - not just the first line, but the entire paragraph.

> >

> > Like this:

> >

> > Paragraph 1: Text

> > Paragraph 2: Text text text text

> > word-wrapped text text text text

> > Paragraph 3: text text text

> > word-wrapped text text text

> >

> > I've tried inserting Spacers, but I don't think I'm doing that

> > correctly. How can I indent entire paragraphs?

>

> Paragraph styles have 3 useful attributes: leftIndent, rightIndent and

> firstLineIndent (in case you want the latter different to leftIndent).

> Just create styles with varying leftIndent for each level you need.

>

>

> If you want to avoid naming one style for each indent level, you can

> use a flowable called Indenter; this can be used to indent all

> subsequent flowables. Create another one with a negative indent to

> cancel things when you're done.

>

> Code can be found below...

>

>

> - Andy

> from reportlab.platypus.doctemplate import Indenter

>

> ----------------------------------------------------

> class Indenter(FrameActionFlowable):

> """Increases or decreases left and right margins of frame.

>

> This allows one to have a 'context-sensitive' indentation

> and makes nested lists way easier.

> """

> def __init__(self, left=0, right=0):

> self.left = _evalMeasurement(left)

> self.right = _evalMeasurement(right)

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

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

>

Do I add these before the Paragraph in order to indent the Paragraph?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20061119/fbc2b809/attachment.html


More information about the reportlab-users mailing list