0

I have to do a visualforce that render a list of list of quotelineitem, that can be spited on more page cause the visualforce is seted to renderAs="pdf". To reach my goal i decide to use an apex repeat nested in another apex repeat. Each list represents a group of qli , my goal is to impose at the iteration to pagebreak only entire grop.

my code actualy is like this example :

<table>
<apex:repeat value="{!QLIG}" var="group" >
  <apex:variable var="num" value="{!0}" />
  <tr style="page-break-inside:avoid;" >
     <apex:repeat value="{!group}" var="item" >
          <tr style="height:35px;page-break-inside:avoid;">
          <td  class="data_table_s">{!item.pn__c}</td>
          <td  class="data_table_m">{!item.cc__c}</td>
          <td  class="data_table_s">{!item.pr__c}</td>
          <td class="data_table_m">{!item.dp__c}</td>
          <apex:outputPanel layout="none" rendered="{!num==0}">
          <td class="data_table_s" rowspan="{!group.size}" style="page-break-inside:avoid;">{!ROUND(item.qt__c, 2) }</td> 
          </apex:outputPanel>
          <td class="data_table_m">{!item.ic__c}</td>
          <td  class="data_table_s">{!item.up__c}</td>
          <apex:outputPanel layout="none" rendered="{!item.vc__c>=0}">
          <td   style="color:green;" class="data_table_m">{!item.vc__c}</td>
          </apex:outputPanel>
          <apex:outputPanel layout="none" rendered="{!item.vc__c<0}">
          <td  style="color:red;" class="data_table_m">{!item.vc__c}</td>
          </apex:outputPanel>
          </tr>
          <apex:variable var="num" value="{!num + 1}"/>
      </apex:repeat> 
  </tr> 
</apex:repeat>
</table>

So the first apex repeat iterate over the list of group of qli and the inner apex repeat iterate over each qli of the group . I try to wrap the whole group in tr where i specified in ccs to "page-break-inside:avoid" because if a entire group can stay on the same page remains there, otherwise the whole group goes to the next page. This solution unfortunately doesn't work . How can i reach the Goal ?

0

It is often assumed that the Visualforce PDF generation is done using Flying Saucer and that documentation says:

Flying Saucer supports all of the CSS page-break properties.

The only limitation is that page-break-before and page-break-after with value avoid only considers siblings vs. all margins which meet at that location (as the spec dictates).

If a rule cannot be satisfied (e.g. a <div style="page-break-inside: avoid;"> spans three pages), the rule is simply dropped as if it never existed.

No mention of tables in that but elsewhere:

-fs-table-paginate

when used with the value paginate, modifies the table layout algorithm to repeat table headers and footers on subsequent pages and improve the appearance of cells that break across pages (for example by closing and reopening borders), but that's all it does. If a table's minimum width is wider than the page, it will be chopped off.

I suggest you read that documentation further to see if there are other options/limitations documented and also review these https://salesforce.stackexchange.com/questions/tagged/pdf questions and answers.

  • Thanks for the answer, but it seems to me that what you described to me is not an integrated solution to salesforce but something external, do you confirm? – riccardo_castellano Jun 21 at 12:46
  • @riccardo_castellano Salesforce incorporates other software into their platform, and for this job of PDF generation they have incorporated Flying Saucer. – Keith C Jun 21 at 12:48
  • Ok, many thanks , now i understand – riccardo_castellano Jun 25 at 8:13
  • i go to this url flyingsaucerproject.github.io/flyingsaucer/r8/guide/… that seams to be a guide to flying saucer . i try to use -fs-keep-with-inline:keep in front of page-break-inside:avoid; but the the result is that the table break the column size – riccardo_castellano Jun 25 at 9:27
  • @riccardo_castellano Sorry to hear that. Suggest you keep looking around for ideas e.g. salesforce.stackexchange.com/questions/tagged/pdf. – Keith C Jun 25 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.