Jump to content
We've recently updated our Privacy Statement, available here ×

firstPageFooter


jwindberg

Recommended Posts

  • Replies 17
  • Created
  • Last Reply

Top Posters In This Topic

there a many ways... here my favorite:

just create two subreports "SR_pagefooter1" and "SR_pagefooterGeneral" ... (note that the pagefooter is a static nonstretching band... so be carefull with band heights in master and subreports)
in the printwhenexpression for the SubReport1 element you use

Code:


for the other SubReport (follow pagefooter) you use

Code:


voilà that's it.

of course you could also place all elements together in the standard pagefooter band... and use also the printwhenexpressions to decide what to print at what page. But I don't like placing elements overlapping each other (not clean design).

hth
C-Box

Link to comment
Share on other sites

If I'm understanding all this correctly, it doesn't quite work.

The footer on the master report needs to be big enough to hold the sub-report, as it is a non stretching band.

Which means that even if the footer does not show on subsequent pages, enough space for it is reserved.

So page 1 has the summary, and all other pages have a big white space that can't be used for details.

Link to comment
Share on other sites

Exactly,

 

but the PAGEFOOTER is made for placing some static element like bank information, impressum, legends.... and perhaps page numbers.

 

Don't understand, why you want to place the summary at the beginning and not as usual at the end?!??!?!

 

Perhaps you could work with the title band for your purpose... otherwise the suggested firstPageFooter has to be introduced really.

 

hth

C-Box

Link to comment
Share on other sites

Look at a credit card bill sometime.

 

The first page has a tear-off on the bottom third of the page. It has the return address and summary information and gets put into an envelope with a clear window.

The top part of the first page is the "detail" area that would list payments and charges. If the charges list is too long, then it continues on page 2.

Page 2 has no "tear-off" summary on the bottom of the page.

 

(oh, and tear-offs are on the bottom, so their bottom edge is smoother, for those automatic machines that read them.)

 

So, yes, I have a summary footer on the first page only.

 

And even with standard static footers, If I wanted a footer on the first page only, I would not want to have reserved space on following pages for that which is not there. I can think of several reports I have done in the past with summaries, or notices, etc, that were on the first page, top and bottom, that did not get repeated on following pages.

Basically, for a tool like jasper, if there exists something like "lastPageFooter" you can assume someone will have a need for "firstPageFooter", "firstPageHeader", and "lastPageHeader".

 

I had assumed in my study of Jasper, after seeing "lastPageFooter", that all of the others existed. I'm very disappointed. I am not looking forward to having to do this bill statement/invoice thing using iText directly.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I have seen similar requirements in the past and here's what you can do:

 

Use a dummy group that does not actually have a header and a footer, but only helps you leave a larger area clear at the bottom of the first page.

This group should have such an expression that it breaks with every record, but only on the first page. On subsequent pages it will no longer break until the end of the document.

The expression would be something like:

 

$V{PAGE_NUMBER}.intValue() == 1 ? $V{REPORT_COUNT} : null

 

You have to set the minHeightToStartNewPage attribute of this group to a value that would cause the group to break sooner on the first page and leave enough empty space there for your first page footer.

 

The page footer in the master document does not have to be tall as the first page footer content. Make it small as it needs to be for page 2 and the rest.

The content of the first page footer could be introduced using a subreport that prints only on the first page (printWhenExpression) and placed at a negetive Y within the page footer band.

 

We have introduced support for the "lastPageFooter" sections because there is no way to know at design time when the last page footer will occur, and only the engine will know when to render it. It is not the same situation with the first page footer which we fully control using the PAGE_NUMBER variable. We are not going to introduce a new report band to support what has been suggested as there are several workarounds that allow controlling the content of the first page headers and footers.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

If I understand all that, I think I can get my report to work that way.

So far, in one report, I have had to do four complex work arounds that I can barely understand using dummy objects, and nested subreports.

If a complete collection of first/last header/footer plus a NUMBER_OF_PAGES_IN_REPORT were available in the tool in the first place, my report would have been done the morning I started it, instead of weeks later.

 

Please don't read too much into my frustration.

With wonderful open source tools available for much of what I do, I don't get funding to pay for commercial tools, so I'm often times stuck using only open source, and in many cases they are better, and I do so much appreciate your help, but with a few extra features so many things could be so much easier to do with Jasper.

Link to comment
Share on other sites

Hi,

I have attached a report template to this post.
Open it in iReport and fill it with any number of empty records (hold the Shift key down and click on the "Execute with emtpy data source" in the toobar).
You will see a larger pink page footer on the first page and a normal green page footer on all subsequent pages.
I think this is want you initially wanted.

I hope this helps.
Teodor
 

Link to comment
Share on other sites

  • 1 month later...

Hi Teodor,

 

now it came, that I have to customize a PrintTemplate for one of our customer, that want's the same discussed in that thread.

 

A large PageFooter at the first page and all following pages just a small one.

 

I tried the trick you posted here.... exactly like in your sample but the DummyGroupAttribute "minHeightToStartNewPage" doesn't have any influence at all.

 

The problem at my template is, that there is just ONE Record in the master-document.... so I guess the GroupExpression you posted doesn't work for me.

Besides that I do have MANY other groups with SubReports that render different contents....

for example:

 

--> MasterDoc

----> Title

-------> SubReport for global FormHeader (Adress, title, etc)

----> PageHeader (just at Page > 1)

----> DummyGroupHeaderForStart (just at Page == 1)

----> TextGroupHeader

-------> SubReport for several leading texts

----> DetailBand

-------> SubReport for several positions

----------> ColumnHeader (for all Types

----------> DummyGroupPosType1Header

-------------> SubReport for Type1 Positions

----------> DummyGroupPosType2Header

-------------> SubReport for Type2 Positions

----------> DummyGroupPosType3Header

-------------> SubReport for Type3 Positions

----> AfterPosGroupFooter (sums, totals, etc)

----> DeliveryAdressGroupFoooter

-------> SubReport for delivery adress

----> InvoiceAdressGroupFooter

-------> SubReport for invoice adress

----> DeliveryTermsGroupFooter

-------> SubReport for delivery terms

----> PaymentTermsGroupFooter

-------> SubReport for payment terms

----> TextGroupFooter

-------> SubReport for several trailing texts

----> SignatureGroupFooter

-------> SubReport for signatures

----> PageFooter

-------> SubReport for FirstPageFooter (with PrintWhen Page ==1)

 

So as you see a quite complex structure... but working fine so far.

But as I think i don't have multiple records at masterdoc (just one, for example on order) your FirstPageGroup Expression isn't evaluated and so the MinHeightToStartNewPage doesn't work.

So the PageFooter at the first page is overlapped through elements from other subreports.

 

So this is why I hope you waste again 10 minutes in thinking about the firstpagefooterband problem again?

 

regards from Germany

C-Box

Link to comment
Share on other sites

  • 5 months later...

I'm having a small issue with this workaround for a first page footer. Using your instructions and template, I am able to generate the first page footer with the background band and dummy group. I have the minHeightToStartNewPage on the dummy group set to 280 pixels. The problem is this... if the detail lines complete within the area of minHeightToStartNewPage (in this case, the bottom 280 pixels of the page) on pages > 1, then the group footer does not print correctly. A new page is started and the group footer prints there. I've tried to accomplish this using the summary band, with the same results.

 

Is there any way to get the group footer/summary band to print within that area?

 

Thanks for any help!

Paul

Link to comment
Share on other sites

I'm sorry, just to clarify: I have 2 other groups in addition to the dummy group. The other 2 groups are used for breaks in the detail. Both of these groups have a header and a footer. When it's time for the last footer to print, and it's within the bottom 280 pixels of the page (the minHeightToStartNewPage setting), a new page is started and the footer prints there.

 

Sorry for any confusion.

Paul

Link to comment
Share on other sites

  • 5 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...