From: galactic on
Hello,

Does anyone know how to tell the cipboard to accept RTF into the
clipboard? I think I have all the steps but one.. has anyone done
this:

1. copied text into a separate area.
2. reformatted text into rtf format.
2. copied.holdtext.createTextRange();
3 . copied.execCommand("copy"); (only for ie)

but when I paste it still comes out as pure text.. not RTF... what am
I missing.

any help would be appreciated.

-Galactic
From: Bwig Zomberi on
galactic wrote:
> Hello,
>
> Does anyone know how to tell the cipboard to accept RTF into the
> clipboard? I think I have all the steps but one.. has anyone done
> this:
>
> 1. copied text into a separate area.
> 2. reformatted text into rtf format.
> 2. copied.holdtext.createTextRange();
> 3 . copied.execCommand("copy"); (only for ie)
>
> but when I paste it still comes out as pure text.. not RTF... what am
> I missing.
>
> any help would be appreciated.


Not sure what you mean by RTF format. However, a range object will
accept this method - execCommand("Copy"). For example, the following
external JS if called by IE will copy the selected page content as
rich text - same as pressing Ctrl+C.

var pwin = external.menuArguments;
var doc = pwin.document;
var sel = doc.selection;
var rng = sel.createRange();

rng.execCommand("Copy");

Open MS Word and do a Paste to check out the results.

From "Copy HTML Code" script of
http://www.vsubhash.com/article.asp?id=65&info=Context_Menu_Extensions_For_IE

--
Bwig Zomberi
From: Dr J R Stockton on
In comp.lang.javascript message <ho9s6p$c46$1(a)speranza.aioe.org>, Tue,
23 Mar 2010 13:26:48, Bwig Zomberi <zomberiMAPSONNOSPAM(a)gmail.com>
posted:

>Not sure what you mean by RTF format.

Wikipedia knows : <http://en.wikipedia.org/wiki/RTF> #1.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7)
Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)
From: galactic on

Thank you BWig,

I just need to know if you know what format to place instead of "Text"

window.clipboardData.setData("Text", rng.htmlText);

I need it to show up in the clipboard as Rich Text only.

Thanks for any help
From: Antony Scriven on
On Mar 25, 4:07 pm, galactic wrote:

> I just need to know if you know what format to place
> instead of "Text"
>
> window.clipboardData.setData("Text", rng.htmlText);
>
> I need it to show up in the clipboard as Rich Text only.

Look up clipboardData on msdn. --Antony