cancel
Showing results for 
Search instead for 
Did you mean: 

Wanted: trigger for pagebreak

Former Member
0 Kudos

Dear experts,


I am writing you with concern to a problem with a form including more the ten tables which are dynamically printed depending on the data.

Except for the address header the form is completely dynamic. This means that a subform (flowing) with all data begins underneath the address header. Further subforms are part of this subform (flowing). They represent the single blocks which are shown depending on the data. The blocks consist of a header (text field), a table (including a heading line) and optionally a closing text (text field). The form is mostly working well.


  • Page break

     If a block begins at the end of a page the unsightly effect can happen that only the header or the header and the table header appear before the      page break is following. I need a solution to check if less than four lines are left (available). If so the page break should be triggered for this particular      block (sub form).



Regards,

Kai

Accepted Solutions (0)

Answers (1)

Answers (1)

konchada_saikrishna
Active Participant
0 Kudos

Hi Kai,

can you put a screen shot of your form hierarchy, so we can understand the structure.

My understanding is that you have some thing like below.

Header Text

---->Table Header

--------> Row 1

--------> Row  :

--------> Row n

---->Table Footer


Now in a page if number of rows displayed are more than say 3 the flow should continue else page break should occur before header text is that right ?


Cheers,

Sai

Former Member
0 Kudos

Hi Sai,

Here the discription form the hierachy

and a screenshot from document

I want to avoid that a block is printed on the actual page if there is only enough space left for e.g. only the header text or only the table header or only one table row. The solutioin I am looking for should check if at minimum there is enough space left for two rows (means header text, table header and two rows). If not the complete block should be printed on the next page. Does this make it clearer? Please do not hesitate to ask any further upcoming questions. Thanks a lot! Kai

pavan_prabhu
Active Participant
0 Kudos

Hello Kai,

  You can check my answers in below thread.

Note: This solution is only applicable if each row has only one line data. The solution will not work if each row has data more than one line.

konchada_saikrishna
Active Participant
0 Kudos

Hi Kai,

Finally I got it, I was just trying to test it before I commit.

The idea is to find out if the previous content and 2nd row of the table are on same page.

I though 2 solutions.

1) recursively read each element on each page and force the content to next page but that's performance killing code.

2) is the logic with some hidden fields and simple scripting I explained below.

Anyways from my below screen shot as highlighted.

1) Have a subform "Identifier" as hidden and is above your 2nd table.
2) with in subform "identifier" have 2 text fields  "One & Two" and both are hidden.

3) With in this Subform "Identifier" have a subform "breaker" with height "0.001" and property "pagination"-after = "Go to next page" and is hidden.

lets talk about scripting.

1) Tabel2.cell2 on layout ready event I get the page I get the row index & page number where this row is being displayed.

when row index = 1, I get the page# and put it in the hidden field "Two".

2) on hidden field "One" layout ready even, same as above put the page number.

3) finally on the "breaker" subform docready event, I check if field one & two values are same, that mean if both field One and 2nd row of the table are on same page when they are on different page I make the breaker visible that will push the entier tabe to the next page.

Also placing the code so you get to understand what I mean.


form1.Body.Subform1.Identifier.Breaker::docReady - (JavaScript, client)

  if(this.parent.One.rawValue != this.parent.Two.rawValue){

  this.presence = "visible";

  }

form1.Body.Subform1.Identifier.One::ready:layout - (JavaScript, client)

  this.rawValue = xfa.layout.page(this);

form1.Body.Subform1.Table2.Body2.Cell2::ready:layout - (JavaScript, client)

if(this.parent.index == 1){

  xfa.form.form1.Body.Subform1.Identifier.Two.rawValue = xfa.layout.page(this);

}

Note: you need to change the element names as per your form anyways.

Thanks,

Sai