更新时间:2023-12-05 10:05:40
function getdocx(url){
var oReq = new XMLHttpRequest();
var arrayBuffer;
oReq.open('GET', url, true);
oReq.responseType = "arraybuffer";
oReq.onload = function (oEvent) {
arrayBuffer = oReq.response; // Note: not oReq.responseText
var binary = '';
var bytes = new Uint8Array( arrayBuffer );
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
var contentfromDocx = window.btoa( binary );
//do what ever you want with this
oReq.send(null);
}