[reportlab-users] Placing narrow table so that it wraps across the page

3 views
Skip to first unread message

William Hudspeth, Ph.D.

unread,
Apr 20, 2011, 11:55:44 AM4/20/11
to reportl...@lists2.reportlab.com
I have a very narrow table with only two columns, but lots of rows. I
would like to break the table itself into multiple 'blocks' (perhaps 3
blocks required) across the page, kind of like newspaper columns, but
with the column headers repeated at the top of each 'block'. The entire
table must also be capable of being split across multiple pages if it is
too long for one page.


header1 header2 header1 header2 header1 header2
val1 val2 val1 val2 val1 val2
val1 val2 val1 val2 val1 val2
val1 val2 val1 val2 val1 val2
val1 val2 val1 val2 val1 val2
.... .... ...

How would one go about accomplishing such a structure?

Thanks,

Bill

_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

Robin Becker

unread,
Apr 21, 2011, 5:13:49 AM4/21/11
to wb...@unm.edu, reportlab-users
On 20/04/2011 16:55, William Hudspeth, Ph.D. wrote:
> I have a very narrow table with only two columns, but lots of rows. I
> would like to break the table itself into multiple 'blocks' (perhaps 3
> blocks required) across the page, kind of like newspaper columns, but
> with the column headers repeated at the top of each 'block'. The entire
> table must also be capable of being split across multiple pages if it is
> too long for one page.
>
>
> header1 header2 header1 header2 header1 header2
> val1 val2 val1 val2 val1 val2
> val1 val2 val1 val2 val1 val2
> val1 val2 val1 val2 val1 val2
> val1 val2 val1 val2 val1 val2
> .... .... ...
>
> How would one go about accomplishing such a structure?
>
> Thanks,
>
> Bill
........

this is actually quite hard. We don't support columnWise splitting of tables,
but this can be considered as ordinary row wise splitting.

Conceptually you will need to have a repeat row count that contains the header
row(s). Then conceptually you need to do the following in a flowable

1) when the table is about to be drawn a) decide whether there's enough room on
the current [age to make it sensible. If not issue a page throw and defer.

2) switch the PageTemplate to a three column layout.

3) issue the table in the three frame layout.

4) switch back to two column or full width layout.

I believe this could all be done in the platypus doctemplate framework by using
existing flowables eg Table and DocIf which can be used to program the framework
inside the story.

I don't have an example to hand, but if you prod me over the next week (when we
have a bunch of holidays) I will try and set one up.
--
Robin Becker

William Hudspeth, Ph.D.

unread,
Apr 21, 2011, 4:08:28 PM4/21/11
to reportl...@lists2.reportlab.com
Thanks Robin,

I will try to figure this out, and see what I can come up with... I may
contact you in a few days if I'm having trouble!

Bill

William Hudspeth

unread,
Apr 25, 2011, 5:58:18 PM4/25/11
to reportl...@lists2.reportlab.com
Hi Robin,

I have been having trouble figuring this out, and would much appreciate
some kind of code outline about how I go about doing this.

Thank you!

Elan Noy

unread,
Apr 27, 2011, 10:58:57 AM4/27/11
to reportlab-users
We would like to embed existing PDF files (example an existing form)
into a ReportLab created PDF. Did anyone do something like that?

Regards

Elan Noy

Robin Becker

unread,
Apr 27, 2011, 11:08:57 AM4/27/11
to bhud...@edac.unm.edu, reportlab-users
On 25/04/2011 22:58, William Hudspeth wrote:
> Hi Robin,
>
> I have been having trouble figuring this out, and would much appreciate
> some kind of code outline about how I go about doing this.
>
> Thank you!
.......
I'll try and get to this Friday which is a Republican Holiday here in the UK :)
--
Robin Becker
Reply all
Reply to author
Forward
0 new messages