DocumentBuilder SearchAndReplace

Post Reply
Posts: 1
Joined: Wed Mar 25, 2020 9:28 am

DocumentBuilder SearchAndReplace

Post by goofy » Wed Mar 25, 2020 9:35 am

I'm using DocumentBuilder 4.4.1
I'm trying modify a existing docx document to modify some text
In this cas i want to remplace teh text "TOTO" by "TITI"
So this my code :

Code: Select all


var oDocument = Api.GetDocument();

builder.SaveFile("docx", "./TESTFILES/test.docx");   // save the resulting text document as a file in the .docx format with a new 'example.docx' name
There is a error :
execute_run_code: oDocument.SearchAndReplace(oDocument,"TOTO","TITI");
execute_run: Uncaught TypeError: oDocument.SearchAndReplace is not a function
in ... andreplace i saw :
SearchAndReplace(oProperties, oProperties.searchString, oProperties.replaceString, [oProperties.matchCase])

the function exists but what is oPropertie ?
Can yoi help me ?

Posts: 396
Joined: Thu Apr 12, 2018 10:00 am

Re: DocumentBuilder SearchAndReplace

Post by Carl » Tue Mar 31, 2020 7:45 am


You are using some old version of Document Builder. The Search and Replace method is not available in this version. Please install the current Document Server version 5.5 and use the Document Builder available there:

Post Reply