Save DOCX template back to DOCX

Hi Zack,

Please find the following code will help get a docx file back after performing docx templating.

        const doc = documentViewer.getDocument();
        const data = await doc.getFileData({
          downloadType: 'templateFilledOffice',
          officeOptions: {
            doTemplatePrep: true
          }
        });
        const arr = new Uint8Array(data);
        const blob = new Blob([arr], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
        saveAs(blob, 'template-filled.docx');
1 Like