Paste Code to Match Existing Formatting

Igor de Oliveira Couto igor at semperuna.com
Fri Apr 19 22:57:27 EDT 2013


On 20/04/2013, at 12:34 PM, charles61 <cszasz at mac.com> wrote:

> Thanks. I am aware of but was wondering how to script this in LiveCode to do this automatically. In the past, I have an option menu where the use could select font and font size for pasting from an app to a word processing document.

I believe that if you simply use the 'copy' command, it will automatically copy all of the information - including all of the formatting - into the clipboard, including font and fontsize (and style, and colour, etc.). 

The user then, in their word processing program, can choose whether to "Paste" the copied text (which will also paste all of the copied formatting), or to "Paste and Match Style" (which will paste just the raw text info - no formatting - and then adjust the formatting to match the style in the user's document).

I believe that if you want to make sure that the user will only copy *raw text* info - without copying any of the formatting - you can use the "clipboardData" property.

If you want the user to be able to copy "some" formatting, but not others - ie., you want them to be able to copy the font and the size, but not the style or the colour of the text - then you will have to roll out your own special "Copy" commands. These commands will likely put the selected text into a variable, 'erase' the unwanted formatting, and then set the clipboardData with the re-formatted text from the variable.

I hope these help.

Kind regards,

--
Igor Couto
Sydney, Australia








More information about the use-livecode mailing list