Search code examples
pdfnpmms-worddocx

nodejs npm libraries to access and modify microsoft word documents


Do you know if it is possible to search specific text like "xAx" into a Microsoft Word file (.doc or .docx) hosted on a website, replace it with some other text input by the user and make the file available for download using nodejs?

Is there a npm library that can do that?

If not it is possible to manipulate a PDF file instead? Please note that I do not want to create the document but manipulate a template file in the server.


Solution

  • There is a project https://github.com/open-xml-templating/docxtemplater which serves for replacing placeholders in .docx files.

    Also supports loops and images, check out following demos :

    https://docxtemplater.com/demo/

    https://docxtemplater.com/demo/#image-replacement

    https://docxtemplater.com/demo/#image