Prev: FAQ Topic - What is the Document Object Model (DOM)? (2010-03-22)
Next: FAQ Topic - Internationalisation and Multinationalisation in javascript. (2010-03-23)
From: galactic on 22 Mar 2010 14:15 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 23 Mar 2010 03:56 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 24 Mar 2010 15:43 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 25 Mar 2010 12:07 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 25 Mar 2010 12:28
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 |