Search & Replace Texts in DOCX
satyajit nayak
Posted on June 9, 2024
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.
💖 💪 🙅 🚩
satyajit nayak
Posted on June 9, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.