wpid2420-media_1344579865856.png

How to Automate ‘Paste and Match Style’ in FileMaker


Copying text from another application, such as a Web browser or Word document, and then pasting that text into a field in a FileMaker database field, can be annoying when the text pasted arrives with an undesirable style, color, font, or font size.

In many programs, such as Numbers, Pages etc, there is the capability to paste in some text copied from an outside source, such as a web page, and have the text come in with a matching style, rather than with the style from its source.

FileMaker 12 – Paste Text Only

wpid2425-pastedgraphic-7.png

FileMaker has this ability as well, but it requires users to remember a complicated key combination or use the Edit Menu to paste in text. In FileMaker 12, this keyboard combination is listed in the Edit menu right below the Paste command, but in previous versions, users had to know to hold down the Option key to display it in place of the regular Paste command. FileMaker 12 also requires the Shift Key to execute, which can lead to ‘twisted claw syndrome’ of the left hand.

Mac:
FileMaker 9, 10 and 11 – Paste Text Only command — Command-Option-V
FileMaker 12 – Paste Text Only command is Command-Shift-Option-V

Windows:
FileMaker 9, 10 and 11 – Paste Text Only command — Control-Option-V
FileMaker 12 – Paste Text Only command is Control-Shift-Option-V

Removing Text Formatting

2014-01-09 Update: One more trick:  This works in all versions, including FM 13. Paste, Undo. Paste your text formatted into a formatted field (Command V on a Mac and Control V on a PC) and then immediately Undo the paste (Command or Control Z). If all goes well, you  should end up with unformatted text.

Fortunately, there is an easier way to handle pasted text consistently from within the field definition. Here is how to automate ‘Paste and Match Style’ in select FileMaker fields.

Options for Field

wpid2423-pastedgraphic-4.png

Add this Calculated Value to the fields you are most likely to be pasting text into.

Start by going into Manage Database and then select the Fields tab and select the field you are going to be pasting text into regularly.

  1. Turn off the ‘Do not replace existing value of field (if any)’ option
  2. Click the ‘Specify..’ button to specify a calculated value.

Calculation to remove formatting

wpid2422-pastedgraphic-3.png

Use the two functions in combination: TextFormatRemove and Self.

Together they look like this: TextFormatRemove(Self)

It is possible to hard code the field name into the first function instead of employing the ‘Self’ function. The reason we are using ‘Self’ is because it saves time in locating the field name. It also saves a bit of time, pasting this formatting stripper function into multiple fields. We will see later why it might be worth using the actual field name.

Pasting styled text into a field

wpid2421-pastedgraphic-5.png

Back out in Browse mode, when pasting in some text from a web page, the font is the wrong type face, the wrong colour and a little too large. This foreign formatting came from the web page. The idea is to have the text match the field formatting setup in FileMaker.

Text reformatted to basic style

wpid2424-pastedgraphic-6.png

Now, when the user exits the field, the auto-calculation kicks in replacing the data with itself, without the foreign text formating—now the text matches the underlying field formatting.

Note: Beware of Older Versions of FileMaker

wpid2420-media_1344579865856.png

Be careful with ‘Self’ function as it only arrived with FileMaker 9, user running earlier versions 7, 8 and 8.5 will have their content replaced with the word ‘Self’ in the field and may lose data. Because Self is not a function prior to FileMaker 9, the older versions act as if the user wants to paste the word ‘Self’ in the field. If older versions of FileMaker are in use, employ the field name rather than the Self function— for example: TextFormatRemove(Listings::KMs).

The advantage of using Self whenever possible is that it makes it easier to copy and paste the same function into a number of fields quickly as long as no users are going to be employing versions prior to FileMaker 9.

About these ads

6 Responses to “How to Automate ‘Paste and Match Style’ in FileMaker”

  1. A great tip to remember.

    I use a varient of this but leave the ‘Do not replace existing value of field (if any)’ option on. I find this is more useful for our application as it allows pasting as unformatted text but also allows subsequent formatting.

    Using your car ad example, perhaps there would be a need to bold or underline “local” in the description. As your technique is presented any attempt to modify it would revert to plain text. Leaving the calc as do not replace… the user could bold the info later.

  2. This is a good tip, but I wish FileMaker would allow a global “off” switch in preferences for this on by default feature of keeping the source formatting of cut and paste text. We didn’t have a problem with cut and paste data until we moved up to FileMaker 12. It seems that the keep source formatting was added by default with this verson.

    We define the style and formatting of data fields when we develop our layouts. Seems counter productive to let a cut/paste circumvent those style definitions. I fail to see the utility in it, and it has been noting but problematic for several areas of our corporate data solution where there is a high prevalence of cut/paste.

  3. Geat tip! Thanks.

  4. Just a quick hint for those that do not want to do the above… Do you know that you can use the PASTE function (cmd-v) and then follow up with UNDO (cmd-z)… This leaves the TEXT but take away the STYLE!! … (Maybe I can take credit for this one… never read it… just happened hihi).

Trackbacks/Pingbacks

  1. How to Automate ‘Paste and Match Style’ in FileMaker | Filemaker Info - May 19, 2013

    […] See on hbase.net […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 36 other followers

%d bloggers like this: