I can create a docx file of type blob
using the following module docxtemplater
, and then give the user the possibility to download the docx file.
In this way:
var zip = new PizZip(content);
var doc = new Docxtemplater().loadZip(zip);
...
var out = doc.getZip().generate({
type: "blob",
mimeType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
});
saveAs(out, "output.docx");
What I would like to do, however, is to give the user the possibility to view the docx file on the browser, during its creation.
I thought I would do something like this to create a url blob:
const objectURL = URL.createObjectURL(out);
But I can't find a way to be able to view the docx file.
Can you give me some advice on how to do it, if there are modules that allow it.
I tried to use react-doc-viewer
but it doesn't work with blob files.