I’ve added a new feature to the 1.7.6 version of PollyReports: additionalbands. A Band instance may have one or more additionalbands defined (as a list of Band instances), and each will be rendered in order after the parent band renders.
Conceptually, this is much like the existing childbands feature; however, childbands become “part” of the parent band, rendering on the same page (and potentially forcing a page break before the parent band). additionalbands are separate from the parent band, and from each other.
I added the feature to deal with a report that needed a two page long report footer. So that’s what it’s for.
additionalbands render as part of the detailband, in groupheaders and groupfooters, and in the reportfooter. They are not rendered as part of a pageheader or pagefooter band. Also note that additionalbands will render childbands of their own.
Remember, you can get PollyReports using pip or by cloning the Github repo at:
Hi, I am currently using your tutorials. When creating a page header the labels always come with a b in front of them. For example if the header is “Page Header” it gets printed as b’Page Header’. Why is this happening and whats the solution?
The notation b’Page Header’ indicates a byte string, which is the kind of string Python 2 uses by default (and thus does not usually print in the b’xxx’ format). Reportlab likes Unicode; I’m guessing either you are using Python 3 or some version of Reportlab that is offended by byte strings.
Take a look at this:
Python 3.2.3 (default, Feb 27 2014, 21:33:50)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = b"Heading"
As you can see, to get Python 3 to accept the byte string as a string I have to use the decode method. You could use the format parameter of the Element class to do this, i.e.
If you are using Python 2, the code would be a little different, but you are still just converting the string to unicode. It appears that the unicode() constructor should do the trick if your page header text is strictly 7 bit ASCII:
Try it out and let me know if you need further assistance.
Thank you for your solution! I use Python 3 and It works!