2

i just read every article about currency conversion but i did not found the solution.

I have a visualforce rendered as pdf with a lot of currency fields. But they were displayed either like 1000.00 or with apex:outputtext 1,000.00 But what i actually need is a solution that the currency is displayed like this 1.000,00 (decimal should be seperated with comma).

Is there any solution to get this fixed? Any help is highly appreciated.

  • One of the solutions would be create custom component that can format whatever you want via apex and use that. Not optimal one, but I was tired to search the same topic few months earlier – kurunve Mar 17 '16 at 15:16
  • thanks for your reply. since i am fairly new to apex and VF, i have no idea how to do that ;) – Tarek Mar 17 '16 at 15:31
  • for example: Component: <apex:component access="Global" controller="Cont" > <apex:attribute assignTo="{!iin}" description="The number" name="myNumber" type="Decimal"></apex:attribute> {!FormattedString} </apex:component>, controller - public class Cont { public Decimal iin { get; set; } public String getFormattedString() { return '$' + inn.format()().replace('.',',')//where magic with apex goes - replace, leading zeroes , separators etc }. Usage: <c:CompName myNumber="123.12" /> on visualforce page – kurunve Mar 17 '16 at 15:46
2

One alternate approach could be to use a string variable on the VF page.

Just define one String variable with getter and setter properties, and assign to it the value of your currency field.

Now you can play with with the formatting of the String as required using standard String methods and finally display the new variable on the page directly.

| 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.