I want to render .doc files after the user upload the files in the browser
In my web app built with React, I have successfully rendered .pdf files using a blob which looks something like this
const someFileFunction = (file) => {
let xhr = new XMLHttpRequest(), resStatus;
xhr.open('GET', file);
xhr.onreadystatechange = someFunction;
xhr.responseType = 'blob';
xhr.send();
function someFunction() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
if (splitUrl(file, "extension") === 'pdf'){
//this.response is a blob as we set the type of response above.
let urlData = URL.createObjectURL(this.response);
document.querySelector('#some-selector').src = urlData
}
}
}
} // someFunction ends here
}
Similar to the procedure which I implemented to render .pdf files using a blob. Can I also render .doc files, if its possible, can anyone kindly elaborate how to do so ?
Thanks in advance :)