12 Replies Latest reply on May 19, 2017 5:05 PM by keywords

    Text Formatting with Copy and Paste

    user12413

      My coworkers frequently cut and paste data to put into our Filemaker system (names and companies, addresses, email addresses, etc).  The formatting of the pasted data rarely matches the data field formatting in the Filemaker field.  I have tried using a calculation with TextFormatRemove and nested formatting functions to set the formatting properly on the data entry fields.  Both methods work.  However, that same formatting seems to be carried throughout my system unless I over-ride it by conditional formatting.  I use names, addresses etc.  extensively throughout our system on reports; the default formatting for those reports is different than for fields on data entry layouts.  Setting the formatting on every report field is getting to be very labor-intensive.

       

      Is there an easier way to make sure cut and pasted data is formatted correctly on data entry fields without affecting the rest of the database?

       

      I know I can use Shift-Control-Option V (mac) to paste data minus formatting.  However, several of my users for the most part have very basic computer skills and don't like having to do anything special - four keys at once may be too much!

       

      Help is always greatly appreciated!!

        • 1. Re: Text Formatting with Copy and Paste
          mikebeargie

          an auto-enter calc of TextFormatRemove(self) on the field will strip all formatting from field contents completely whether typed into or pasted.
          TextFormatRemove

           

          If you want to do something more complicated than that the still uses formatting, it'd arduous since they literally could be pasting any content in with any one of millions of rich text formatting combinations. GetAsCSS() will return the html code of rich formatted text if you want to head down that path: GetAsCSS

           

          The usual preference is to strip all formatting from the field automatically, then use filemaker field styles or conditional formatting to apply a non-permanent (not stored as rich text) style.

          • 2. Re: Text Formatting with Copy and Paste
            john_wolff

            Hi,

             

            Using Cmd-Z after each paste will remove all formatting of the pasted text letting the field format remain.

             

            HTH,

             

            John

            • 3. Re: Text Formatting with Copy and Paste
              user12413

              Hi John -

               

              Tried Cmd - Z.  It did not work.

               

              We are all Mac -- is that a Mac Command?

               

              Also, that is not an option in the Filemaker menus that I can see.  If I'm pasting into Filemaker it won't work if it's not on a menu, right?

              • 4. Re: Text Formatting with Copy and Paste
                mikebeargie

                It’s command + z (not ctrl) AFTER paste:

                 

                Cmd + V (paste)

                Cmd + Z (removes formatting OR undo for paste if NOT formatted)

                Cmd + Z (undo for paste)

                 

                Same for windows with ctrl instead of cmd

                Note it will undo the paste if there is not any formatting for the +z when you use it the first time.

                • 5. Re: Text Formatting with Copy and Paste
                  john_wolff

                  You have to use that keystroke combo immediately after pasting in the text with its undesirable formatting, not sometime later.

                  Has always worked for me . . .

                  Cheers,

                  John

                  • 6. Re: Text Formatting with Copy and Paste
                    user12413

                    Eureka!!!  I understand.................and it worked!

                     

                    Thanks, John -- you're a lifesaver.

                    • 7. Re: Text Formatting with Copy and Paste
                      john_wolff
                      Eureka!!!  I understand.................and it worked!

                      You may now have some User Training ahead of you . . .

                      If that's not successful then Mike's first suggestion of the AutoEnter calc will be your saviour.

                      Cheers,

                      John

                      • 8. Re: Text Formatting with Copy and Paste
                        user12413

                        I think my users can handle this simple solution.

                         

                        One thing I wanted to clarify --- and get an explanation for -- is the TextFormatRemove function.  I did use that originally in my solution.  But (and it's a big one!), the pasted text format was only removed when I copied to my original input field.  Everywhere else I used that field carried the formatting from my original field/layout.  NOT the formatting of the pasted text, but the font, size, and style of my defined input field in FM to which text was pasted.  So if I defined formatting differently on another layout (such as using the field in a header), it did not conform to the header format on the new layout.  I had to create a formula to change the font, etc. on the new layout.

                         

                        I don't understand why (if the formatting is removed) the text does not conform to the defined formatting of the field on any given layout.  Why does it pick up/keep the formatting of the original field it was pasted into?

                        • 9. Re: Text Formatting with Copy and Paste
                          Philip_Jaffe

                          When you copy rich text, its formatting gets copied along with it.  Pasting this in a field brings the formatting along with it. TextFormatRemove strips the rich text formatting from the text and leaves only the plain text.

                           

                          Formatting on a layout is applied to the layout object, not the data displayed by that object.  So you can display that data with any formatting you like depending on the formatting of the object it inhabits (field, text object, merge field, etc.

                           

                          If the text already has rich text formatting applied, it will override any object level formatting.  I usually make all my text and number fields auto-enter textformatremove. That way I know I am al aye starting with the plain text. Then I can format however I need on an object by object and layout by layout basis.

                          • 10. Re: Text Formatting with Copy and Paste
                            Philip_Jaffe

                            If you use text format remove as an auto enter, be sure you uncheck "Do not replace existing..."

                            • 11. Re: Text Formatting with Copy and Paste
                              philmodjunk

                              And keep in mind that if you add an auto-enter calculation to a field or modify an existing calculation, your existing records do not re-caclulate. Only newly created records and records where you modify  a field referenced in the calculation (and then only if the field is non-global and field in the same record), will see a change due to the added/modified auto-enter calculation.

                               

                              You'd need to use the same basic expression in Replace Field contents (or use one of several other batch update tricks) to get updated data/formatting in the existing records.

                              • 12. Re: Text Formatting with Copy and Paste
                                keywords

                                john_wolff wrote:

                                 

                                You have to use that keystroke combo immediately after pasting in the text with its undesirable formatting, not sometime later.

                                While that is true, it is possible to use this same technique later if you forget to do so at the time, or perhaps don't realise that you have imported undesirable formatting. What you do is:

                                1.     Select the entire field contents

                                2.     Cut it from the field (command X or equivalent)

                                3.     Paste it back into the field (command V or equivalent)

                                4.     THEN immediately undo (command Z or equivalent)

                                 

                                In effect, you are simply repeating the initial data entry process (steps 1 – 3) to then make available the Undo trick again.