在"ondrop"上事件使用javascript将Word文档转换为文本或字符串 [英] On "ondrop" event convert word document to text or string using javascript
本文介绍了在"ondrop"上事件使用javascript将Word文档转换为文本或字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用peer.js将Word文档从一个用户发送到另一个用户 可以很好地处理文本文件(.txt,文本/纯文本),而在Word文档中我没有得到任何内容的地方.
i was trying to send word document from one user to another using peer.js it is fine working with text file (.txt, text/plain) where ever on word document i'm not getting content.
这是我到目前为止所做的事情
here is what i did till now
box.on('drop', function (e) {
e.originalEvent.preventDefault();
var file = e.originalEvent.dataTransfer.files[0];
eachActiveConnection(function (c, $c) {
if (c.label === 'file') {
if (file.type == "text/plain") {
alert("type : " + file.type + " - sendable");
c.send(file);
} else {
//here i need to convert word document into text/plain or atleast to string and send the file by using // c.send(file)
}
推荐答案
我不是专家,但是AFAIK docx文档遵循的标准不是简单的纯文本(就像RTF一样).我有机会 DOCX.js ,它有望将docx base64字符串转换回来到HTML.
I'm not an expert, but AFAIK docx documents follow a standard which is not simple plain text (as RTF is). I'd give a chance to DOCX.js, which promises to transform docx base64 strings back and forth to HTML.
这篇关于在"ondrop"上事件使用javascript将Word文档转换为文本或字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文