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



// 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

228 vues

Posts récents

Voir tout

Me contacter

  • Twitter
  • YouTube

Biel/Bienne - Bern - Switzerland