js导出word

function areaword(value) {
    var wd = new ActiveXObject("Word.Application");
    var doc = wd.Documents.Add("", 0, 1);
    var range = doc.Range(0, 1);
    var sel = document.body.createTextRange();
    sel.moveToElementText(value);
    sel.select();
    sel.execCommand("Copy");
    range.Paste();
    wd.Application.Visible = true;
    return false;
}

注意Automation 服务器不能创建对象,需要打开Internet选项,自定义安全里面的所有ActiveX选项

原文地址:https://www.cnblogs.com/baozi/p/3200213.html