function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SteveSellSteveSell 

VisualForce <apex:repeat>

Hi there,

 

this is a snippet from a page renderas="pdf"

 

<apex:repeat value="{!ResultsPos}" var="field2">

<!--style="page-break-before:always;"-->

<!--page-break-inside:inherit;-->

<tr>

<td><apex:outputField value="{!field2.Bezeichnung__c}" styleClass="myfontBrief"/></td>

<td align="right"><apex:outputField value="{!field2.Anzahl__c}" styleClass="myfontBrief"/></td>

<td align="right"><apex:outputField value="{!field2.Einzelpreis__c}" styleClass="myfontBrief"/></td>

<td align="right"><apex:outputField value="{!field2.Summe__c}" styleClass="myfontBrief"/></td>

</tr>

</apex:repeat>

 

 

public List<FakturaPosition__c> getResultsPos()

{

List<FakturaPosition__c> outResultsDetail = new List<FakturaPosition__c>();

outResultsDetail = [select Anzahl__c,Einzelpreis__c,Summe__c,Bezeichnung__c,Faktura__r.Vertrag__c from FakturaPosition__c where Faktura__c = : ApexPages.currentPage().getParameters().get('id')];

//outResults.add(outResultsDetail);

 return outResultsDetail;

 

}

  

It is possible to get a loop number from the repeater because this content into this repeater is much bigger for on PDF site and i would like

make a custom page-break. For example: <div style="display:{!IF (counter = 15 , 'block','none')}; page-break-before:always;"></div>

 

Thanks very much

Steve

Best Answer chosen by Admin (Salesforce Developers) 
SteveSellSteveSell

I have create a workaround with a new class "FakturaPositionen" in my extension class.

Now I receivd the index from the row and I can make a custom page-break.

 

 public List<FakturaPositionen> getResultsPos()

{

List<FakturaPosition__c> outResultsDetail =

[select Anzahl__c,Einzelpreis__c,Summe__c,Bezeichnung__c,Faktura__r.Vertrag__c

from FakturaPosition__c where Faktura__c = : ApexPages.currentPage().getParameters().get('id')];

 

List<FakturaPositionen> fplist = new List<FakturaPositionen>();

Integer index = 0;

for (FakturaPosition__c fp : outResultsDetail)

{

fplist.add(new FakturaPositionen(index++, fp));  

}

 return fplist;

 

}

 

public class FakturaPositionen

{

public Integer index {get; set;} public FakturaPosition__c pos {get; set;}

 

public FakturaPositionen(Integer i, FakturaPosition__c fp)

{

index = i;

pos = fp;

 

}

}

 

 

VF Page

 

<apex:repeat value="{!ResultsPos}" var="field2">

<!--style="page-break-before:always;"-->

<!--page-break-inside:inherit;-->

 

<tr>

<td valign="top"><apex:outputField value="{!field2.pos.Bezeichnung__c}" styleClass="myfontBrief"/></td>

<td valign="top" align="right"><apex:outputField value="{!field2.pos.Anzahl__c}" styleClass="myfontBrief"/></td>

<td valign="top" align="right"><apex:outputField value="{!field2.pos.Einzelpreis__c}" styleClass="myfontBrief"/></td>

<td valign="top" align="right"><apex:outputField value="{!field2.pos.Summe__c}" styleClass="myfontBrief"/></td>

<td valign="top" style="display:{!IF(field2.index = 25,'block','none')};page-break-before:always;"></td>

</tr>

</apex:repeat>