[reportlab-users] Paragraph, text and spaces
Peter Milliken
peter.milliken at gmail.com
Thu Jul 1 20:38:14 EDT 2010
Thanks - I don't have a mental model for HTML, since I have never used it.
Does this mean each call to Paragraph (with a single line of text) is
implying an implicit linefeed at the end of each line? I really don't see
how this works with the part of the description that refers to providing
correct indentation for triple quoted Python comments - that part of the
description seems misleading - unless you pass the entire triple quoted
comment into the same Paragraph call?
Anyway, thanks for the help
Peter
On Fri, Jul 2, 2010 at 9:24 AM, Tim Roberts <timr at probo.com> wrote:
> Peter Milliken wrote:
> > Still playing with reportlab :-)
> >
> > I am trying to print strings of text using Paragraph. These strings
> > are lines of code listings so they include spaces to show indentation
> > (spaces - not tabs). When I 'print' the document all of the spacing/
> > indentation has been removed! i.e.
> > ...
> > "The following text creates an instance of the Paragraph class:
> > Paragraph(text, style, bulletText=None)
> > The text argument contains the text of the paragraph; excess white
> > space is removed from the text at the
> > ends and internally after linefeeds."
> >
> > I am more than happy with excess white space removed from the end of
> > the line of text, but why am I seeing white space removed from the
> > beginning?
>
> Because that's white space that immediately follows a linefeed. The
> mental model for Paragraph is similar to the HTML <p> tag, which does
> the same kind of thing. The reason you use Paragraph is because you
> want it to manage the spacing. If you want your text to be printed
> without formatting, then you should use a Preformatted flowable, not a
> Paragraph flowable. That's what it's for.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100702/b1aeafc1/attachment.html>
More information about the reportlab-users
mailing list