0

This question already has an answer here:

I have a component that I am using with a visualforce email template. It's a simple table that I get from a controller query to display Opportunity Products. I want ot format the totalprice field so instead of 10000 it shows 10,000. I found a lot of questions that suggest

<apex:outputText value="{0, Number, Currency}">

My problem is I'm not using output text because of the table part so I'm not sure where to put the value. Example:

    <table border = "0" cellspacing = "4">
        <tr>
            <td>Product Name</td>
            <td>Currency Code</td>
            <td>Total Price</td>                
        </tr>
        <apex:repeat value="{!olis}" var="o">
        <tr>
            <td>{!o.Product2.Name}</td>
            <td style="text-align: right"> {!o.CurrencyIsoCode} </td>
            <td value="{0, Number, Currency}"> {!o.TotalPrice} </td>              
        </tr>
        </apex:repeat>        
    </table>

What am I doing wrong? I can save the component but no formatting takes place in the template;

marked as duplicate by glls, Raul, Patlatus, Reshma, battery.cord Apr 18 at 15:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

I got it to work by doing this:

<tr>
    <td>Product Name</td>
    <td>Currency Code</td>
    <td>Total Price</td>                
</tr>
    <apex:repeat value="{!olis}" var="o">
        <tr>
           <td>{!o.Product2.Name}</td>
           <td style="text-align: right"> {!o.CurrencyIsoCode} </td>
           <td> <apex:outputtext value="{0, Number, Currency}"> 
                <apex:param value="{!o.TotalPrice}" />
                </apex:outputtext></td>              
        </tr>

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