Generate a Word document in JavaScript with Docx.js?
问题 I am trying to use docx.js to generate a Word document but I can't seem to get it to work. I copied the raw code into the Google Chrome console after amending line 247 to fix a "'textAlign' undefined error" if (inNode.style && inNode.style.textAlign){..} Which makes the function convertContent available. The result of which is an Object e.g. JSON.stringify( convertContent($('<p>Word!</p>)[0]) ) Results in - "{"string": "<w:body> <w:p> <w:r> <w:t xml:space=\"preserve\">Word!</w:t> </w:r> </w:p