Hey guys, I have created a package name edit-office-file which can search & replace multiple text strings inside a DOCX file as well other office files.
First install the pkg:
npm i edit-office-files
.Usage style:
import {SearchAndReplace} from 'edit-office-files';
async function main() {
const searchTexts = ['Hello World', 'are You', 'coloured'];
const replacementTexts = ['REPLACEMENT1', 'REPLACEMENT2', 'REPLACEMENT3'];
const reader = new SearchAndReplace('assets/document.docx', searchTexts, replacementTexts, 'updated.docx');
await reader.process();
}
main();
Here is the github link for the project.
Top comments (0)