13 Replies Latest reply on Jul 29, 2013 9:13 AM by philmodjunk

    Text Formatting Help



      Text Formatting Help


           I have the master layout I use for data entry, all fields are set to use the same font & size. I copy information from another application and paste it into FMP 12 for one particular field. When I do it carries the formatting from the application I copied it from which is 'Times New Roman' 12 point.

           My layout uses 'Verdana' 12 point


           I thought I would make a script that I click a button next to that field and it changes it to the correct format, which it works but when I go to another layout which uses 'Arial' 8 point that field is the wrong size.

           I have been beating my head trying to figure out why it is doing that or what I am doing wrong.


           Here is the script:

      TextFontRemove ( Hot Wheels Database::${Deco (Tampo/Color)} )

      TextFont ( Hot Wheels Database::${Deco (Tampo/Color)} ; "Verdana" )


           Any help would be greatly appreciated,



        • 1. Re: Text Formatting Help

               Use just TextFormatRemove and remove all formatting from the pasted text. Then the formats specified for the field via the inspector's appearance tab will control the formatting of the data in the field.

               You can use

               TextFormatRemove ( Self )

               as an auto-enter calculation on the field with the "do not replace existing value..." check box cleared and any new pastes into this field will automatically have all formatting removed.

               You can use TextFormatRemvoe ( PutYourFieldNameHere ) with the Replace field contents tool to do a batch update of your existing data.

          • 2. Re: Text Formatting Help

                 I tried both solutions and they do format to the current layout but if I switch to the one with the Arial 8 it hasn't changed? Any reason why it isn't or anything I need to check?

            • 3. Re: Text Formatting Help

                   THis is a frequently recommended fix used by many different FileMaker Developers.

                   There isn't two solutions here, just one. One application of it works for future records and one cleans up your existing data. Replace Field contents should be used after you use Show All Records to pull all records into the current found set as this tool only modifies records that are in the found set.

                   If you did Replace Field Contents after selecting SHow All records already, better check to make sure that this field formatted with arial, 8 is the same field.

              • 4. Re: Text Formatting Help

                     Ihave it set up as an auto-enter calculation for the field and it changes when I go to the next field but when I go to the other layout this is what I see:


                • 5. Re: Text Formatting Help

                       Is this the same record? Is it the same field?

                       Please note that the auto-enter calculation will only kick in when you enter/modify data in the field. Text entered into the field before you added this auto-enter calc will not update to remove the formatting. That's why you also need to use Replace Field Contents as a one time fix to "clean up" your pre-existing text.

                  • 6. Re: Text Formatting Help

                         Yes, same record, same field. I just created this record and copy and pasted to that field and once I tab to the next field it changed it to the format I have set for that layout as seen below:



                    • 7. Re: Text Formatting Help

                           Then if I switch to this layout, this is the result and all the fields are set to the same format for text:



                      • 8. Re: Text Formatting Help

                             Here is another layout I have and again all the fields are set for the same format and that is the only field that is a problem:



                        • 9. Re: Text Formatting Help

                               Let's try a small experiment.

                               Add a new text field to your table. Define the same textFormatRemove ( Self ) auto-enter calculation for it.

                               Use replace field contents to copy the data from the current field to the new field. Place this new field on your layout and format it as needed.

                               Does it then show the correct formatting?

                          • 10. Re: Text Formatting Help

                                 Made the new field, but I am lost on the next step, just a novice with FMP, can you please elaborate?

                            • 11. Re: Text Formatting Help

                                   If you have done the Replace Field Contents operations I suggested earlier. These steps should be very familiar.

                                   Make a back up copy of your file. (replace fields will modify every record in your table and cannot be undone. this back up copy enables you to discard the original file and use your back up copy if you make a mistake during this process.)

                                   Open Manage | Database | Fields. Double click the definition for the new field. Click the Auto-Enter tab. Click the calculation option. Copy and paste this text into the field:

                                   TextFormatRemove ( Self )

                                   Clear the "do not replace existing value..." check box.

                                   Go to a layout based on this same table. (The table should be listed in Layout Setup | Show Records from).

                                   Enter layout mode.

                                   Use the field tool to place the new field on your layout.

                                   Enter browse mode. Click or tab into the new field.

                                   Select Show All Records from the Records menu

                                   Select Replace Field Contents from the Records Menu

                                   Select the Calculation option.

                                   Select or enter the name of the original field as your calculation.

                                   Perform the Replace Fields operation.

                              • 12. Re: Text Formatting Help

                                     Haven't tried the above yet, but last night I added a new record with no change but I decided I would select the entire contents of that field and then right click and set the font and size. Which when I did it was the correct format for that layout but I selected it again anyway and then I jumped to one of the other layouts that won't format correctly and it was correct. Not sure why it works that way but not using the script or the auto enter.

                                • 13. Re: Text Formatting Help

                                       I have not specified any script. I would check to see if the "Do not replace existing value..." check box is selected for the field. It should not be selected.