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
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.
FileMaker 9, 10 and 11 – Paste Text Only command — Command-Option-V
FileMaker 12 – Paste Text Only command is Command-Shift-Option-V
FileMaker 9, 10 and 11 – Paste Text Only command — Control-Option-V
FileMaker 12 – Paste Text Only command is Control-Shift-Option-V
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
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.
- Turn off the ‘Do not replace existing value of field (if any)’ option
- Click the ‘Specify..’ button to specify a calculated value.
Calculation to remove formatting
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
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
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
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.