[reportlab-users] decimal and/or dot-leader tabs
Glenn Linderman
v+python at g.nevcal.com
Sun Sep 11 20:44:59 EDT 2011
On 9/11/2011 12:40 AM, Glenn Linderman wrote:
> I have a need to generate a PDF with either a decimal tab, or a
> dot-leader. (I get to choose whichever one is easier to implement!)
>
> I found the discussion thread here which is similar to my question....
> http://permalink.gmane.org/gmane.comp.python.reportlab.user/5567
>
> However, it is not clear to me if, or how, this can be integrated into
> platypus as a flowable. Can it be? Or is there a better solution
> that I haven't found yet?
>
> Hmm.
> http://two.pairlist.net/pipermail/reportlab-users/2011-April/010011.html
> is pretty recent, and indicates that it doesn't.
>
> http://comments.gmane.org/gmane.comp.python.reportlab.user/5563
> implies there might be something that might happen, but the lack of
> followup postings isn't encouraging.
>
> Aha, discovered the "Table of Contents" flowable in the userguide.
> That'll get me going, for now. It isn't as general as multiple tabs
> like the first discussion thread mentioned, and I'd prefer a decimal
> tab, and three columns would be better, but the TOC style will do for now.
So the example code in the userguide says it is a fully working example,
but actually, it is missing a definition of "delta". That was easily
cured, but is a bug in the docs.
Then the docs also say:
> Entries to the table of contents can be done either manually by
> calling the addEntry method on the TableOfContents object or
> automatically by sending a 'TOCEntry' notification in the
> afterFlowable method of the DocTemplate you are using.
Since I don't really understand flowables and their data structures, and
certainly not multiBuild and its implications, and since I know all the
TableOfContents data before doing the layout, I thought calling addEntry
manually would be easier... but it doesn't work to just call addEntry
when building the story list... I just get the placeholder text.
Looking at platypus/tableofcontents.py source code, I see that
"beforeBuild" clears the _entries after copying them to _lastEntries,
and isSatisfied checks to see if _entries and _lastentries have the same
count, but I have no idea how or when these methods are called, having
not yet figured out how flowables work.
However, it would seem that the case of manually calling addEntry
doesn't work properly, which would seem to be a code bug, or else a
severe misunderstanding of the documentation. I tried both build and
multiBuild just in case, but it would seem that the multiBuild should
work even if it is overkill, but both produce only placeholder entries
for TableOfContents :(
Does anyone have a working example of a TableOfContents built with addEntry?
I'll work up a failing sample next, I guess, since this is blocking
progress.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110911/49634cc5/attachment.html>
More information about the reportlab-users
mailing list