Jump to content

Inserting formatted type as a Rule


Cat

Recommended Posts

At some point I found instructions showing me a Rule interface that looked exactly like a text frame control. This allowed for the creation of formatted text to be chosen like a Rule and placed into a text frame.

The problem I'm trying to figure out is how to have superscript $ and cents so that $5.00 would have tiny dollar sign and cents value. Ideally as a single rule to be placed into a text frame so it can be controlled as a single object.

I have tried to search in the Forums and I keep getting the same cases listed on almost all the links retired in the search. No matter how I phrase my request.

Link to comment
Share on other sites

You might be thinking of "Create Resources" in the Steps palette. Add / Formatted Text / Edit.

Even if you go this route though, if your data has embedded $ or cents, you will still need a rule to setup the superscript.

I think I would forgo that and just setup a formatting rule for your amount field like this:

var amount = Field("Amount").replace(/[^0-9.,]/g, "").split(".");

return '<superscript>$</superscript>' + amount[0] + '<superscript>' + amount[1] + '</superscript>';

This calls in your amount, removes any non numerical entity, like a dollar sign, then splits it into an array with 2 sections at the decimal point.

Then you are returning a superscript $, the dollar amount (at index 0), then superscript cents (at index 1).

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...