Tip 7 #4D Write Pro - Find/Replace

Mis à jour : 24 juin 2019

Here is a little piece of code that allow you to find and replace a string by another inside a 4D Write Pro document.

Don't forget to replace Form.WPObj, et Form.replace in the code

Code pour le Chercher/Remplace dans un document Write Pro



// Find

$allText:=WP Get text(Form.WPObj)


$find_col:=New collection



If ($pos>0)

$find_col.push(New object("pos";$pos;"length";$length))

End if

Until ($pos=0)

// Replace

For ($i;$find_col.length-1;0;-1)


$range:=WP Text range(Form.WPObj;$find.pos;$find.pos+$find.length)

WP SET TEXT($range;Form.replace;wk replace)

End for

268 vues0 commentaire

Posts récents

Voir tout

List of 4D Components and Plugins

I realize that there is no list of existing components and plugins in 4D. I think it can be cool to make such kind of list to try to have a kind of catalog where people can look at to see what is avai