4D Write Pro: Easily locate all the breaks

Automatically translated from English

4D Write Pro documents support five types of breaks:

  • line breaks
  • paragraph breaks
  • page breaks
  • section breaks
  • column breaks

 

Sometimes, you need to locate a certain type of break to replace it with another, or simply delete all its occurrences in the document. To make this possible, we developed a new function: WP Get breaks.

Get user breaks

New command

WP Get breaks returns by default all five types of breaks. These are explicit breaks, meaning breaks that have been intentionally entered by the user, either on their keyboard or from a menu or context menu.

The other breaks, caused by the page layout, for example, are not taken into account because they’ve been inserted implicitly, for display or printing purposes. They are not part of the document.

This command can also, on-demand, return only a given type of break, such as page breaks for instance.

The result is very easy to use because this new command returns a collection of ranges that are directly usable by other commands that take this type of argument as a parameter.

Some examples

Thanks to this command, it’s now easier to replace section breaks with simple page breaks.

It’s also possible to locate multiple paragraph breaks. You can therefore delete duplicates or replace all of them with page breaks, replace column breaks with paragraph breaks, and so on.

Code Sample 

The sample code below replaces all the line breaks with paragraph breaks:

// Find all the line breaks
$_filteredBreaks:=WP Get breaks(WParea; wk line break)
// Replace them with paragraph breaks
For each ($break; $_filteredBreaks)
  WP INSERT BREAK($break; wk paragraph break; wk replace)
End for each 

Easy, right?

Next STEPS

You’ll find everything you need to know in the documentation. And as always, for all kinds of questions or feedback, feel free to join us on the 4D forum.

Roland Lannuzel

• Product Owner & 4D Expert •

After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.

Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.