UNPKG

docx-hub

Version:
27 lines (26 loc) 593 B
<!DOCTYPE html> <html> <head> <script src="index.js"></script> <script> function test(input){ var d=data.value.trim() if(d.length==0) d="{}" require("docx-hub").assemble(input.files[0],JSON.parse(d)).then(function(assembled){ assembled.save() input.value="" }).catch(function(e){ input.value="" alert(e.message) }) } </script> </head> <body> <input type="file" style="position:absolute;top:0" onchange="test(this)"> <br/> <br/> <textarea placeholder="json data for assembly" id="data" style="width:98%;height:200px"></textarea> </body> </html>