473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Copying html text with format to clipboar?

I found some information about copying text to clipboard in IE,
but it does not preserve html formats.

Is this possible to copy some html area, and when I paste it into MS Word or Excel,
I could see the same fonts, table, colors, blah, blah... on Word or Excel??

Regards,
KwonNam.
Dec 1 '05 #1
5 2314
Son KwonNam <kw******@ihatespam.xxx> wrote:
^^^^^^^^^
And I dislike people who falsify sender addresses and spoil namespaces, too.
Tough luck.
PointedEars
Dec 1 '05 #2
I´m interested in the same topic. I want to copy formated text from a
label (span) to word still having it formated with tables etc.
My code now looks like

window.clipboardData.setData("Text", mySpan.innerText);
or
window.clipboardData.setData("Text", mySpan.innerHTML);

Using the first line the text is copied unformated. Using the second
line the text is copied with the html-tags, which is then also visible
in Word when pasting.

Anyone have an idea on how to accomplich this?
Son KwonNam: Please let me know if you found the solution.

Thanks
/ Stefan

Dec 1 '05 #3
SteveSu wrote:
I´m interested in the same topic. I want to copy formated text from a
label (span) to word still having it formated with tables etc.
My code now looks like

window.clipboardData.setData("Text", mySpan.innerText);
or
window.clipboardData.setData("Text", mySpan.innerHTML);

Using the first line the text is copied unformated. Using the second
line the text is copied with the html-tags, which is then also visible
in Word when pasting.

Anyone have an idea on how to accomplich this?
Son KwonNam: Please let me know if you found the solution.


You need to think about what is happening. If what you copy is not a
valid HTML document or document fragment, what should the receiving
application do with it? What will the clipboard do with it?

Look at Edit -> Paste special in Word to see what your options are.


--
Rob
Dec 1 '05 #4
Thomas 'PointedEars' Lahn said the following on 11/30/2005 8:36 PM:
Son KwonNam <kw******@ihatespam.xxx> wrote:
^^^^^^^^^
And I dislike people who falsify sender addresses and spoil namespaces, too.
Tough luck.


But at least it's not a forged sender address :)

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 1 '05 #5
Thanks for the reply RobG!
Using window.clipboardData.setData("Text", mySpan.innerHTML); i got
html in the clipboard.
I tried to do a "paste special" in Word but my only options are
Unformatted Text and Unformated Unicode-Text which both results in the
html being pasted into word.
Do you know how I can make it work?

Dec 1 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gey-Hong Gweon | last post by:
Is there a way to copy a PIL image to windows clipboard (as a dib image or a bitmap, I suppose)? What I would like to accomplish is to do a fast copy and paste of images from my python...
22
by: Matt | last post by:
When browsing a web page a user has the ability to highlight content on a page (by holding down the left mouse button and dragging the mouse over the desired content). Is there a way to disable...
5
by: nivas.meda | last post by:
Hi, I have an excel sheet with a graph and cells.If i change the value in the excel cells the graph will reflect.Now i am going to implement this functionality in html page.I successfully saved...
4
by: nick_faye | last post by:
hi guys, hope somebody can assist me. i have two ms access database. i have to copy the entries in database1 to my database2. however, i have to copy entries from database1 that does not...
3
by: Tom van Stiphout | last post by:
I have written some code to export all objects to text files, and to import those files back into a new database. Hopefully this will eliminate some forms of corruption. The icing on the cake...
10
by: Cocy | last post by:
Hi, This might be a sort of FAQ, but I don't see why, so I would someone help me to understand what's wrong? I've just created following code which wold trim white space(s) in a (given) string....
1
by: Eric | last post by:
Couple of general webform questions. Most are about html code created/managed by the editor. I work in GridLayout Mode. 1. Is there a reference or guideline for how the html should appear when...
48
by: mantrid | last post by:
Hello Is there a way to prevent users copying a full size image from a web page. Displaying the image with a smaller width and height only affects the image as viewed, the actual full size image...
2
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.