Jump to content
JasperReports Library 7.0 is now available ×

Group Header does not start on a new page even when 'Start on a new page' is checked


shriyakish

Recommended Posts

Hello,

I need a specific text in Details band to come on a new page. So I create a dummy group and add the field to the group.

But when I set property ' start on a new page' to true, it still continues with the Detail section.

Please help.

I am using IReport 3.5

 

Thanks.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

Try setting "minHeightToStartNewPage" property in Scriptlet,

Important:

minHeight  <  (Page height) - (Header + Footer + external groups) height

don't set "Start on a new page" property for the group

 

Good luck!

 

Code:
public void beforeGroupInit(String groupName) throws JRScriptletException{    if (groupName.equals("myGroup")) {        JasperReport jr = (JasperReport) getParameterValue("JASPER_REPORT");        JRGroup grp = getGroup(jr, "myGroup");        Boolean isNewPage = {define_your_condition};        if (isNewPage) {            grp.setMinHeightToStartNewPage(450);        }        else {            grp.setMinHeightToStartNewPage(0);        }    }}public static JRGroup getGroup(JasperReport jr, String groupName) {    JRGroup group = null;    if (jr != null) {        JRGroup[] groups = jr.getGroups();        if (groups != null) {            for (int i = 0; i < groups.length; ++i) {                if (groups[i].getName().equals(groupName)) {                    group = groups[i];                    break;                }            }        }    }    return group;}
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...