Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Formatting Text


Thread Tools Search this Thread Display Modes
Old May 14th, 2018, 01:19 AM
Olivier Olivier is offline
Junior Community Member
Join Date: Jun 2011
Location: Paris, FRANCE
Posts: 37
Default Formatting price

Hi friends, I have to build a FusionPro template with a text rule to be able to have prices like this :

I know how to use the € as a superscript but need help to place the cents bellow the €.

Help is more than welcome !

Best regards,
FusionPro 10.0.26
AcrobatPro 10.1.16
InDesign CC2017
MacOS 10.12.6
Reply With Quote
Old May 15th, 2018, 10:05 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,322
Default Re: Formatting price

It's hard to know exactly what you need to do without seeing at least the data. You could create a table, or use something like a repeatable component. But if the price is always going to be on a fixed position on the page like that, then I think the easiest thing is just to have three separate text frames: One for the integral price, one for the Euro symbol, and one for the cents. You only need two rules to populate the two frames with the parts of the price, something like this:
// "Whole" amount
var price = parseFloat("$3".replace(/[^\d\.]/g, ''));
return Int(price);
// Cents
var price = parseFloat("$3".replace(/[^\d\.]/g, ''));
return FormatNumber("00", Math.round((price % 1) * 100));
Or, inject both parts in OnRecordStart:
var price = parseFloat("$3".replace(/[^\d\.]/g, ''));
FusionPro.Composition.AddVariable("WholePrice", Int(price));
FusionPro.Composition.AddVariable("Cents", FormatNumber("00", Math.round((price % 1) * 100)));
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Old May 22nd, 2018, 01:00 AM
Olivier Olivier is offline
Junior Community Member
Join Date: Jun 2011
Location: Paris, FRANCE
Posts: 37
Default Re: Formatting price

Thank you Dan,
I did it that way using 2 frames

have a great day,
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 06:09 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.