1 Reply Latest reply on Jun 13, 2012 5:59 PM by davidanders

    Pasting Data from other sources into FM fields, but maintaining default font

    MarkKluis

      Title

      Pasting Data from other sources into FM fields, but maintaining default font

      Post

      We just switched from FM9 to FM12.  We are constantly copying and pasting text from other sources into our FM layout fields.  I have all fields set to a default of Arial sized 12.  When I paste text from other sources, it keeps it in the fonts of the source, and I want it to automatically reformat to Arial 12.  Out databases did this when they were in FM9 version, but since we switched to FM12 I have all kinds of fonts and sizes in my fields.   Any help would be appreciated.

        • 1. Re: Pasting Data from other sources into FM fields, but maintaining default font
          davidanders

          http://help.filemaker.com/app/answers/detail/a_id/5674/kw/styled

          How do I remove text formatting from a field?       Updated: Dec 03, 2011

          Sometimes text within a field has had formatting applied to it (color, bold, font, size, etc.). Formatting applied to text within a field will override field formatting applied to the field as a whole when in layout mode. It's possible to create conflicting formats by creating one format for a field object in Layout mode, and a contrasting format for field data in Browse mode. Here is how FileMaker Pro resolves text formatting conflicts:

          • When you format a field in Layout mode, the formatting affects only the appearance of that particular occurrence of the field object.
          • When you format field data in Browse mode, this formatting is stored with the data, and you see it in any layout that displays that field. Field data that is formatted in Browse mode takes precedence over data formatting in Layout mode. For example, if you format field text as Bold in Browse mode, then switch to Layout mode and format the same field as Plain Text, the text will continue to display as bold.

          It is often desirable to remove this formatting in order to make the text in the field comply with the field's formatting.

          The easiest way to achieve this is to use the TextFormatRemove function.

          This removes all text formatting from text in a single action. All fonts, styles, font sizes, and font colors are removed from the specified text.

          The following methods show how to implement these functions:


          Method 1: Prevent text from being formatted during data entry.

          A field can be defined to make sure data is entered in a specific format, or within a certain range. To save time and ensure accuracy, you can set FileMaker Pro to automatically enter unformatted data in a text, number, date, time, and container fields. For example, field.

          To set options for automatic data entry:

          1. With the database open, choose File menu > Define > Database.
          2. In the Define Database dialog box, click the Fields tab.
          3. If your database contains more than one table, select the appropriate table from the Table list.
          4. Select your text field from the list of existing fields, or define a new one, for example fieldA.
          5. Click Options (or double-click the field name). 
          6. In the Options for Field dialog box, click the Auto-Enter tab and select the Calculated Value (or click Specify), then enter the following calculation.

            TextFormatRemove(fieldA)
          7. To make an auto-enter calculation self-modifying, leave the Do not replace existing value for field (if any) option unchecked.

          Since Auto-enter calculations can be self-referencing, this will ensure that any data that has been entered will be stripped of any text formatting.


          Method 2: Remove existing text formatting using the replace command

          You can replace the contents of a field in all records or in a found set with a calculation that also uses the TextFormatRemove function.

          Important:  This process overwrites a field in every record (or every record in the found set) with a new value. You can't undo replacing field values. Before you begin, consider making a backup copy of the file. 
           
           To replace field values in every record in the found set:

          1. If necessary, find, omit, or sort the records in the database file.
          2. In Browse mode, in the current record, select the contents of the field you want to replace, for example fieldA.
          3. Choose Records menu > Replace Field Contents.
          4. In the Replace Field Contents dialog box, select Replace with calculated result, then click Specify.
          5. In the Specify Calculation dialog box, enter the following calculation:

            TextFormatRemove(fieldA)
          6. Click OK.

          This method is good for changing one field at a time on a given set of records or all records.

          The following are alternative methods that will also achieve this:


          Method 3:  Manually reformat the text
           

          To eliminate formatting applied in Browse mode, manually reformat the text in Browse mode.

          Sometimes when there are a small number of fields and records involved, it is simpler to just select the text in question while in Browse mode and change it to the appropriate font, font size, and font style using the selections available from the Format menu (you can turn off multiple styles by using the plain text option). Make sure you select all the text in the entire field or else other layouts may not conform to the changes.


          Method 4: Export and Import text
           

          To eliminate formatting applied in Browse mode, export data as text and re-import the data.

          This method is useful when multiple fields across multiple records are affected. The process of exporting and importing information as tab or comma separated text will strip a field's contents of its formatting. In order to use this method, find the affected records and export them to a tab separated text file. Then, import those records using the setting 'Replace data in current found set.

          Important: Do not change your found set after exporting. Always, backup your database before executing a change like this, in case you make a mistake.

          Additional information can be found in the following FileMaker Pro Help topics:

          • Exporting data from FileMaker Pro
          • Importing data into an existing file

           

          Other webpages about FMP 12