0

I have a simple visualforce page that I am exporting to excel. There is a nested loop and I need to be able to force a line break (new excel row) after each iteration of the inner loop. How would I go about that?

My page:

<apex:page standardController="Pay_Period__c" extensions="PayPeriodExport_extn" sidebar="false" contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true">
    <apex:pageBlock title="Export Results">    
        <apex:pageBlockTable value="{!Timesheets}" var="TS"> 
            <apex:repeat value="{!TS.Budgeted_Timesheet_Distributions__r}" var="BTSD"> 
                <apex:column value="{!TS.Employee__c}"/>
                <apex:column value="{!BTSD.Program_Name_Short__c}"/>
                <apex:column value="{!mapTotalHrs[TS.ID][BTSD.Budgeted_Program__c]}"/> <!--- Need line break here --> 
            </apex:repeat>
          </apex:pageBlockTable>

Thank you!

2

You should be able to use breakBefore:

<apex:column breakBefore="true" value="{!TS.Employee__c}"/>

Or, you could probably use an apex:panelGrid:

    <apex:pageBlockTable value="{!Timesheets}" var="TS"> 
      <apex:panelGrid columns="3">
        <apex:repeat value="{!TS.Budgeted_Timesheet_Distributions__r}" var="BTSD"> 
            <apex:outputField value="{!TS.Employee__c}"/>
            <apex:outputField value="{!BTSD.Program_Name_Short__c}"/>
            <apex:outputText value="{!mapTotalHrs[TS.ID][BTSD.Budgeted_Program__c]}"/>
        </apex:repeat>
      </apex:panelGrid>
      </apex:pageBlockTable>
| improve this answer | |

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.