Jump to content
Server Maintenance This Week. ×

Inserting styled text


This topic is 8539 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi- first time poster. I'm an editorial assistant at a publishing house, and I'm working on scripting a database where one of the fields contains what is generally a very long string of text and various editors look over each record and insert some HTML code linking it to other records. Now, I've done some scripting so that they merely have to select the text they want linked, and click a button, and the HTML code from the other record will be automatically inserted if it matches the title of another record. The thing they want, though, is for this inserted text to be bold and red. Is there any way to do that?(I know once you start calculations, the formatting gets thrown out.)

Thanks for your help,

David Rothschild

Link to comment
Share on other sites

There's no direct way to do this. There are two options, but one of them is Mac only, I'm afraid. There's a plug-in called Styler which adds this functionality. Check out this web site:

http://www.fmplugins.com/action.lasso?-database=plugins.fp3&-layout=main&-response=plugindetail.html&-recid=92&-token.did=&-search

The other solution is a workaround to the fact that you can't script the changing of text formating within a field. It does have some limitations, but it should work.

Basically, you create two fields, one that the user enters data into, and another that provides formatting for some of the text.

Place your field Text on the layout and create a second field called Text_Format that is on top of the Text field. Make Text_Format so that it doesn't allow user entry. This way when the user clicks on it, they will be taken to the Text field underneath. Text_Format is formatted in the way you want, such as having all the text be red.

Let's say that Text has the following string:

"Thank God it's Friday."

Your user highlights "God" and wants to set it to be red. You need two additional fields: gText_To_Format holds the text highlighted and Spaces is a global text field that has enought spaces so that you can insert as many as you like. Here's the script:

Copy []

Paste [ select, gText_To_Format ]

Set Field [ Text_Format, Left( Spaces, Postion( Text, gText_To_Format, 1, 1 ) - 1 ) & gText_To_Format ]

Here's a major limitation. You have to use a monospaced font such as Courier, or the number of spaces that you insert won't be the same vertical length as the text you don't have formatted.

Also, the script I have above will only allow one area of text to have the formatting. But the idea could be altered to allow more. I'm just doing this off the top of my head. I'm sure that others have perfected the technique beyond this.

Chuck

Link to comment
Share on other sites

This topic is 8539 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.