w:keepNext (Keep With Next)

Prevents a page break between this paragraph and the immediately following paragraph.

Parent elements

Description

w:keepNext prevents a page break from being inserted between this paragraph and the immediately following paragraph. It is an on/off toggle property defined in ECMA-376 Part 1 §17.3.1.15.

It is commonly set on heading styles to ensure a heading and at least the first line of the following body paragraph remain on the same page. If page layout cannot avoid a break, the constraint is ignored.

Attributes

Attribute Type Possible Values Description
w:val ST_OnOff true, 1, on (enabled) / false, 0, off (disabled). Omitting the attribute is equivalent to true. Toggles keep-with-next on or off.

Examples

<w:pPr>
  <w:keepNext/>
</w:pPr>

Notes

  • Typically set on heading styles (Heading 1, Heading 2, etc.) rather than individual paragraphs.
  • Works with w:keepLines — both can be present on the same paragraph.