Page 1 of 1

Copying text in a field including the font style

Posted: Sun Oct 13, 2013 3:01 pm
by jasper500
I am writing a character map program for mac and am having problems copying the rtf text in a field. I am using this code to copy the field contents:
set the clipboard data["rtf"] to the rtf text of field "CharsToCopy"
But when I paste it into word, the font is different. Any ideas why this isnt working?

Re: Copying text in a field including the font style

Posted: Sun Oct 13, 2013 3:49 pm
by dunbarx
Hi.

Do you have a typo in that you separate the words "clipboard" and "data"?

Anyway, try using "the htmlText" property. This preserves the text attributes.

Craig Newman

Re: Copying text in a field including the font style

Posted: Sun Oct 13, 2013 6:26 pm
by jasper500
Yes Craig, sorry about that, I did use clipboarddata and rtftext as single words but it still didn't work

Re: Copying text in a field including the font style

Posted: Sun Oct 13, 2013 6:34 pm
by dunbarx
So, how about the htmlText?

Craig

Re: Copying text in a field including the font style

Posted: Sun Oct 13, 2013 6:41 pm
by Simon
OK lets roll these 2 topics into 1
Jasper500.. don't double post your questions and if you can post a stack that displays this problem :)

Hi Craig.

Simon

Re: Copying text in a field including the font style

Posted: Sun Oct 13, 2013 7:48 pm
by jacque
If you haven't set a specific font for the field text, it will inherit the default font from the IDE. That means both the rtf and html text won't have a font specification when you copy it. When you paste it into Word, since there is no font specified, Word will use its default font.

Re: Copying text in a field including the font style

Posted: Tue Oct 15, 2013 9:25 am
by jasper500
Hi Jacque, I have indeed set the font type for the field and Craig I tried to post my stack on the forum, but was not allowed to, presumably because I am new to the forum. However I am narrowing down the problem in that the code : set the clipboarddata["rtf"] to the rtftext of field "CharsToCopy" works for ASCII characters 0 to 127. Characters from 128 to 255 are different to the ones expected.
I suspect that I might have to use unicode, so will look into this further.