OL Learn

How to supress a pagebreak on some lines (widow/orphan)

I have a script building a table, using “

” at the beginning of each added row. The table breaks as expected, when a row would go past the allowed margin. However, sometimes I have a table line that is a one or two line subhead for following lines, and I want those to wrap with the following lines. IE: “wrap anywhere after table rows 1-n, but do not break after line n+1, n+2, n+3; then resume normal wrap behavior.” Basically this is keep the subhead on line n+1 and n+2 with at least one following line (n+3) before wrapping. I would be OK with wrapping either before or after the subhead.
If I leave off the data-breakable “” the whole line does not print.

this is using

, which was supressed in posting.

OK, try again. This used “.<.t.r. d.a.t.a.-.b.r.e.a.k.a.b.l.e.=.”.”.>.”

When you wan to show this: <data-breakable>
You need to write it like this: &lt;data-breakable&gt;

Rough solution:

Increment LineCount each time a line is added to the table.
After each line is added, execute either function bodywrap() or headingwrap(), depending on whether I am adding a subheading or body line.
Function bodywrap will wrap by appending a “page-break-before: always” line if we are on page 1 and at line 43 or greater, or line 59 on page 2 or greater, and also increment the page count and set line count back to 1.
Headingwrap is the same as bodywrap except it kicks in at line 40 or 56, so that a heading will wrap a little sooner; we don’t want a heading followed by one or no lines before wrapping.