2019.2

Table Of Contents
var promoTxt = loadhtml('snippets/promo-en.html', '#' +
record.fields['YOGA']);
results.html(promoTxt);
The following script loads a snippet. Then it looks for a placeholder (@var2@) in the text of that
snippet and replaces every found placeholder by the text '<i>OL Connect 1</i>'. It uses html()
so the HTML formatting (<i> and </i>) will indeed be interpreted as HTML. Finally, it places the
snippet in the template.
var mysnippet = loadhtml('snippets/snippet.html');
mysnippet.find('@var1@').html('<i>OL Connect 1</i>');
results.replaceWith(mysnippet);
overflows()
The overflows() method returns a boolean value indicating whether an HTML element
overflows its box boundaries.
This function could for instance be used in a design where content needs to flow separately
from the main text flow, or where a new, full-page, multi-column box should be inserted when
the current one overflows.
Note that when called in a Standard script, this method runs before the pagination of Print
output. After pagination - in the output, and in Preview mode - the element's overflow may have
changed, especially when the element is combined with floating elements (i.e. elements that
have the CSS style float) and located near a page-break.
To prevent this from happening, it may help to set the element's CSS style to overflow:hidden.
The overflows() method can also be used in a Post Pagination script.
Tip
You don't need a script to resize text in order to make it fit in a box. The Copy Fit feature
automatically scales text to the available space (see "Copy Fit" on page757).
Examples
var $box = query("#mybox");
while ( ! $box.overflows()) {
//do something
}
A slightly shorter version:
Page 1316