1 Reply Latest reply on Jul 8, 2010 3:35 PM by philmodjunk

    Script to format text already in field ?



      Script to format text already in field ?


      FMP 10 DB with approx 700 records, lots of text content -

      a couple of fields need new text formatting - ie font size etc

      I know about the functions :

      TextFormatRemove ( )
      TextStyleAdd ( )

      but I only know how to use them in fields BEFORE anyone has pasted any content into them, to strip formatting as text is pasted.

      So how can I work these into a script for fields that already contain text, goal being to strip formatting and apply a standard font size ?


        • 1. Re: Script to format text already in field ?

          Best way to remove the formatting:

          Step 1:

          1. Go to a layout where this field is displayed, select Show All Records and click in the field.
          2. Choose replace field contents from the records menu.
          3. Specify "by calculation" and enter an expression: TextFormatRemove ( YourTable::YourField )
          4. Do the replace.

          Step 2:

          1. Find this field's definition  in Manage | Database | Fields and double click it.
          2. Select the auto-enter tab
          3. Select the calculation option and enter: TextFormatRemove ( Self ) and clear the "do not replace existing value..." check box.

          Step 1 fixes your existing data, Step 2 keeps it from happening in the future. When it comes time to format your data for output, it's usally best to select the field while in layout mode and specify a format for the field instead of formatting the text itself.