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


Thread Tools Search this Thread Display Modes
Old August 19th, 2008, 03:23 PM
Admin's Avatar
Admin Admin is offline
Join Date: Oct 2007
Posts: 331
Default Setting the $ Character in Superscript for Prices

Copy and paste everything below this line:

This rule automatically superscript the dollar sign for pricing. Prior to using this rule, you need to set the superscript offset and ratio values in the Global Paragraph Settings dialog box. To do this:
  1. Double-click any text frame and click the Edit Text… button.
  2. In the Variable Text Editor, click the Paragraph button.
  3. In the Paragraph Formatting dialog box, click the Global Settings… button.
Once you have set the values, change the field "Price" in this JavaScript rule to the name of the field in your data.

// set superscript font size and baseline shift in template:
// Variabe Text Editor --> Paragraph... --> Global Settings...
// Superscript (Ratio and Offset).
// Set price field name here.

priceVariable=priceVariable.replace("$", ""); //remove dollar sign if entered by user
priceVariable=FormatNumber("##,###.00##", priceVariable); //format as price with two digits after decimal point
var dollarsCentsArray=priceVariable.split("."); //divide up dollars and cents
dollars = dollarsCentsArray[0];
cents = dollarsCentsArray[1];
//format with superscripted dollar sign/cents if dollars are entered
//or with superscripted cent sign if no dollars entered
if (dollars!="")
return '<superscript>'+"$"+'</superscript>'+dollars+'<superscript>'+cents+'</superscript>';
return cents+'<superscript>'+"˘"+'</superscript>';
Forum Administrator
PTI Marketing Technologies, Inc.
Reply With Quote
Old September 9th, 2016, 02:38 PM
ReneTamol ReneTamol is offline
Forum n00b
Join Date: Nov 2012
Posts: 6
Default Re: Setting the $ Character in Superscript for Prices

Is there a way to use this script, but change it slightly to have the cents font size be larger?
Reply With Quote

javascript, rules

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 02:19 AM.

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