Jump to content
Changes to the Jaspersoft community edition download ×

Band height dynamically decrease?


lknueve

Recommended Posts

 Hello. 

I have a Page Header where I only want a couple of text fields to display on the first page. The problem is that they are large text fields, and when going to page 2, the column header band doesn't start until about half way down the page due to these fields in the page header band. I have in the properties of the text fields the "Print When Expression" set to "$V{PAGE_NUMBER} == 1" which is working, but is there any way to set the page header to shrink when these fields are not displayed? Any help would be great thanks! 

 

Link to comment
Share on other sites

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

Instead of putting print when expression on the test fields themselves put it on the page header band itself, this will eliminate the band completely except for the first page. Probably the easiest way. I can think of another if that doesn't work for you, let me know
Link to comment
Share on other sites

Let's get creative shall we.....  I think I have another alternative as well which I will try but this might work for you.

Add another detail band and make sure it's the first detail band.  Put this fields you want to show on the first page only in this detail band and set the print when expression to "$V{REPORT_COUNT} == 1"

What this will do is only print that detail band for the first record and therefore should print directly after the page header on the first page only.  

Didn't say it would be pretty.

 

Link to comment
Share on other sites

Another alternative might be to put a subreport in the page header and set the size really small, say like 1x1 pixel or 0x0 for that matter, then put the print expression on the subreport that way it will only be printed on the page headers you want to include it on.
Link to comment
Share on other sites

 well, I've tried both options you've listed -> the additional detail band throws my column header band in the wrong location, and the subreport is giving me a blank first page? Do you by any chance have other ideas? Thanks so much!!! 

 

Link to comment
Share on other sites

Didn't realize you were using columns/colum-headers,  options still valid and to be sure I create a sample, have a look at the pdf (attached) I think this is what you are trying to do?

Adding a subreport to the page header section.

Definitely works for me,  I have attached two screen shots to show you what I did,  i added a subreport in the page header of the main report and set the size 1x1 just below the text that will appear on each header page.  I set the print expression to only run the report on the first page, I pass in an empty datasource, see report1.jpg (attached)  On the sub report I just added a title band with the info I want to print, no detail bands will print as the report data source is empty, see report 2.jpg (attached)

BTW, I also validated that the other other option using a detail band as a "fake" second page header band works with columns in detail bands but requires a slightly different approach.   If the above still doesn't work for you, let me know and I will send further instructions.
 

 

Link to comment
Share on other sites

  • 1 year later...

 I know this is an old issue but I have exactly the same problem. I tried your solution but it didn't work in my case, I think it's due to iReport 3, which is the iReport version I'm using in my project. Is it possible? In my case, the subreport is never printed, even though I don't set a conditional expression. Any idea?

Thanks in advance.

Link to comment
Share on other sites

Hi guys,

if there are different page-header sizes needed and you don't want to use SubReports you coud think about a simple "dummy" group with option "ReprintHeaderAtEachPage" set to true.

So the GroupheaderBand will be printed at every page.

With an addional groupheader (right click in ireport... add another group header band) you coud easily manage two different sized header bands... the first with PrintWhenExpression : $V{PAGE_NUMBER}.intValue() == 1    and the other with $V{PAGE_NUMBER}.intValue() > 1

So you needn't use the static page-header band and have two different sized header bands for each page.

 

btw. the group-expression could be empty or just null

just my two cents

hth

C-Box

Link to comment
Share on other sites

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...