[reportlab-users] Doing multiple pages with variable data
Mike Driscoll
mdriscoll at co.marshall.ia.us
Mon Jul 6 17:10:06 EDT 2009
Hi Tim,
> Mike Driscoll wrote:
>
>> I know this is probably a common question, but I'm not finding the
>> answer in the archives so far. I have a large dataset with varied
>> lengths of data. Basically, it will be a list of lists or a list of
>> dicts. Anyway, I don't really know how much will be able to fit per
>> page with my current requirements. What is the recommended way of
>> putting semi-random data onto multiple pages and getting it to break
>> correctly? Do I have to count the number of lines I've output somehow?
>>
>
> I guess it depends on how much you need to do to the data. Platypus is
> really good at managing documents that consist of a series of
> "flowables". If your data can be arranged in a series of things of
> variable height that are page-wide, then what you ask is pretty easy.
> You can just derive your own class from Paragraph and lay things out
> yourself.
>
> If you need spreadsheet-like functionality, where things need to break
> within cells and cells can be arbitrarily large, that's where things get
> really tricky.
>
>
I noticed that Platypus is supposed to do what I want, but there doesn't
seem to be many good examples. I have some annoying requirements due to
the fact that the original was based on a Crystal Report. Basically, I
have some boxed headers kind of like this (except I need three or more
of these columns right next to each other horizontally):
-----------------------------------
* Some Heading
*
* Hours Amount
-----------------------------------
ct 24.00 456.84
h
# various other lines may follow
-----------------------------------
Another Heading
50.56
# various other lines may follow
It's a financial document, so I'll need the Amount column to have some
underlines at specific junctures to indicate some kind of total. I may
be able to use the weird example on Frames in the user guide. It looks
like I can create Frames of a certain width and at a certain location on
the page, but the docs don't say if I can leave the height to be
calculated on the fly. If not, then this won't work either.
Anyway, if you or someone else on the list has a suggestion, that would
be great. In the meantime, I'll continue trying to grasp how to set this
up in my head and by messing with some down and dirty coding. Thanks!
- Mike
More information about the reportlab-users
mailing list