Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs npm libraries to access and modify microsoft word documents

Tags:

npm

ms-word

pdf

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.

Thank you for your help.

like image 482
user1536396 Avatar asked Mar 11 '15 20:03

user1536396


People also ask

How do I gain access to a Word document?

Method 1.Select the file that gives you the error “Cannot open Word document: access denied” and right-click on it. From the list, select Properties. Then click on Security, then click on the Advanced or Edit tab. Then click Add, then Add Permissions, then Select a Principal, then Advanced.


1 Answers

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

Also supports loops and images, check out demo (examples) on http://javascript-ninja.fr/docxtemplater/v1/examples/demo.html

like image 55
VasekCh Avatar answered Dec 15 '22 00:12

VasekCh