Unable to open a saved DOCX file

Product: WebViewer

Product Version: 10.9.0

I am doing a proof of concept that shows a docx on your WebViewer and saves it back to a docx after editing. The first part worked perfectly but I could not make the second part work as expected. I can see the file “test.docx” created but for some reason, the file could not be opened by MS Word. I used the code below:

const doc = documentViewer.getDocument();

const data = await doc.getFileData({
	downloadType: 'office',
   
});
const arr = new Uint8Array(data);
const blob = new Blob([arr], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
saveAs(blob, 'test.docx');

This part is very important for our application. Would you please guide me on this?

1 Like