J. Landman Gay
jacque at hyperactivesw.com
Wed Mar 22 14:38:36 EST 2006
pmbrig at comcast.net wrote:
> I am using a button to put a text field on the clipboard. I set the
> clipboarddata["html"] to the htmltext of the field, then when I try
> to paste into MS Word, my field formatting does not come through.
> Instead, the default textFont and textSize for the stack is what
> determines the format of the pasted text -- I have experimented with
> this, and changing the field properties has zero effect on the paste,
> whereas changing the stack properties changes the paste. As an added
> complication, though, setting the textFont of the stack works
> perfectly, but when I set the textSize of the stack to 10, it comes
> through as 12. All other sizes work the way they are supposed to:
> stack textSize of 9 results in size 9 text in the paste, stack
> textSize of 14 comes through as 14, etc. Only stack textSize of 10
> comes through as 12.
> here's the relevant portion of the script:
> put fld "wordPath" into wordpath
> put fld "letterPath" into letterPath
> put theHdr into fld "formatPrintText"
> set the textFont of fld "formatPrintText" to "Bookman Old Style"
> set the textSize of fld "formatPrintText" to "10"
> set the clipboarddata["html"] to the htmltext of fld "formatPrintText"
> set the clipboarddata["text"] to theHdr -- * see below
> launch letterPath with wordpath
> * (I've tried not setting the clipboarddata["text"] and it makes no
> I'm puzzled. The clipboarddata["html"] clearly is not getting set
> properly. I am using Dreamcard v2.6.1 build 152 on a Mac iBook
> running OSX v10.4.5, and Word for Mac v11.2.3. The problem with the
> size 10 getting seen as size 12 appears to be a Word problem, since
> the paste into another text app comes through as expected.
> Why doesn't the htmlText of the field get onto the clipboard? Why in
> the world should the default text properties of the stack have any
> effect here?
When you set the text properties of a field, the text it contains has no
styling of its own, it uses inheritance of the field's properties to
give an appearance of styling. Therefore, when you copy that text, there
is no particular htmltext assigned to it.
To fix that, set the styling of the actual characters in the text
itself, which does assign html properties to the text:
set the textfont of char 1 to -1 of fld "formatPrintText" \
to "Bookman Old Style"
set the textsize of char 1 to -1 of fld "formatPrintText" to 10
This should give the results you are looking for.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the Use-livecode