8 Replies Latest reply on Nov 18, 2009 12:29 PM by marihari

    reset all fonts in fields

    donok

      Title

      reset all fonts in fields

      Post

      Hello - I have a bunch of fields that have content that was pasted from lots of sources, and as a result, the font formats vary from record to record - how do I reset the font in a field?  Also I have a problem with repeating fields where different lines have different fonts.  I just want to wipe all formatting and force everything to be one font.

       

      Thanks in advance,

      Don 

        • 1. Re: reset all fonts in fields
          ninja
            

          Howdy donok,

          Welcome to the forum and thanks for the post.

           

          It seems odd that you would have multiple fonts in a single field...are you sure the fields are "text" rather than container fields?

           

          The easiest way to force font uniformity is to highlight all your fields on the layout (drag window or shift&click) then either right click or pull down Text format and choose your font of preference.  This should handle all of your fields at once.  If you have multiple layouts, you'll have to do this for each layout.

           

          Hope this helps.

           

          Note that if you select everything with a drag-window, you will affect your field labels as well, so take care...

          • 2. Re: reset all fonts in fields
            FentonJones
              

            No, I don't think that's what donok is talking about. I believe he meant there is text IN the field which brought in custom styles formatting from some other source, like the web, etc., when pasting in Browse mode. Such formatting will override the Layout mode default format of the field.

             

            There are ways to remove it, and to stop it happening in the 1st place. The basic technique is to use the auto-enter by calculation option of a text field. Uncheck the "Do not replace existing value". 

             

            The actual calculation used depends on what version of FileMaker you have. I will assume FileMaker 9 or 10; though similar but longer calculations will also work back to 7. 

             

            In the fields with the undesired custom formatted text, create an auto-enter calculation:

             

            TextFormatRemove ( Self )

             

            This will remove all custom formatting whenever the field is evaluated, like immediately after someone pastes text in, then tabs out.

             

            However, that will not fix what's in the fields already. So, what you can do is a Replace Field Contents, using a variation of the above formula. You can use the TextFormattingRemove() function, but you have to put the actual field into it, not just Self. FileMaker does not support using the Self logical function this way (don't know why; it will tell you it doesn't). So, for a Web_txt field, it would look like:

             

            TextFormatRemove ( Web_txt ) 

             

            That's the field itself, not in quotes. Show All Records first (or at least those with this stuff). You must have your cursor in the field before choosing Replace. Type in the calculation, then hit Replace. You MUST backup your database immediately before EVERY manual use of the Replace command. If you slip, you could easily wipe out the data of that field, and there is NO Undo! Practice first.

             

            Or you could go thru the offending records fields, type a space at the end, then delete it. Safer, but very tedious. 

             

            • 3. Re: reset all fonts in fields
              donok
                

               

              Thanks - Yes, this is what I was talking about... Even with these tricks, it was still a challenge. 

               

              I found the best bet was to change the layout default font to something weird - like cooper black 18pt - that way I could tell when a line had formatting, because some of the entries were very close to the layout (verdana vs helvetica) or they might have a font size that was identical to my layout, which had the effect of ignoring any layout font changes - bah. 

               

              I stuck with the TextFormatRemove ( Self ) and clicked through all the fields - only a hundred of them :-(  

               

              I found trying to use TextFormatRemove ( Web_txt ) in the Replace Field Contents was a little odd to handle - at one point I saw that I had replaced all my records with the same content (thanks for the back-up warning) 

               

              Anyway, all done and a good lesson learned to only import plain text!

               

              Thanks, Don  

               

              • 4. Re: reset all fonts in fields
                ninja
                  

                Nicely done Fenton Jones,

                 

                I learned something today and it's not even 8AM.  Thanks for sharing your experience.

                • 5. Re: reset all fonts in fields
                  marihari
                     I am having the same problem, but am using a much older version of FM - ver. 6 to be exact... any suggestions on a solution?
                  • 6. Re: reset all fonts in fields
                    philmodjunk
                      

                    If I remember the trick correctly, in older versions you can use a script or Replace Field Contents to set the field to a calculation that happens to return the value of the field.

                     

                    If your field is called YourTableOccurrence::TextField

                     

                    Then click in this field with all records in the found set and use Replace Field Contents with the "replace with calculated result option"--entering YourTableOccurrence::TextField as the calculation. If that doesn't work, try YourTableOccurrence::TextField & "" and see if that works.

                    • 7. Re: reset all fonts in fields
                      littledog
                        

                      But what about calculation fields?

                       

                      I use a bit different technique to change text font in calendar making application: http://www.hierarchy.lv

                      where more than 120 filed font must be changed. 

                       

                      Font change is made by script.

                      Main part of the script :

                      If (MiddleWords ( FieldType ( Get ( FileName ) ; Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName ) ) ; 2 ; 1 ) = "Text")

                      **/this is for faster processing - bypass no text fields 

                      Set Field by Name [(Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName ))] ; [TextFont ( Get ( ActiveFieldContents ); Kalendars::Font ; Roman)]

                      [] - show field and content. 

                       

                      • 8. Re: reset all fonts in fields
                        marihari
                           Truly appreciated! This worked and now the end of my project is actually in sight :) Thanks again!