#1
|
||||
|
||||
![]()
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:
// 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=Field("Price") ///////// 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>'; } else { return cents+'<superscript>'+"˘"+'</superscript>'; } |
#2
|
|||
|
|||
![]()
Is there a way to use this script, but change it slightly to have the cents font size be larger?
|
![]() |
Tags |
javascript, rules |
Thread Tools | Search this Thread |
Display Modes | |
|
|