Let's say I have a simple rtf code like this:
{\rtf1\ansi\deff0 {\b Hello} World}
How would I use javascript to put it into my clipboard so that I could paste this into microsoft word?
I was trying this code to put it into the clipboard, but it puts the literal characters into the clipboard instead of interpreting it as rtf code:
function copyToClip(str) {
function listener(e) {
e.clipboardData.setData("text/rtf", str);
e.preventDefault();
}
document.addEventListener("copy", listener);
document.execCommand("copy");
document.removeEventListener("copy", listener);
};
Aucun commentaire:
Enregistrer un commentaire