Compartir a través de


KeepNext Class

Defines the KeepNext Class.When the object is serialized out as xml, its qualified name is w:keepNext.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.OnOffType
        DocumentFormat.OpenXml.Wordprocessing.KeepNext

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class KeepNext _
    Inherits OnOffType
'Usage
Dim instance As KeepNext
public class KeepNext : OnOffType

Remarks

[ISO/IEC 29500-1 1st Edition]

17.3.1.15 keepNext (Keep Paragraph With Next Paragraph)

This element specifies that when rendering this document in a paginated view, the contents of this paragraph are at least partly rendered on the same page as the following paragraph whenever possible.

This means that if the contents of the current paragraph would normally be completely rendered on a different page than the following paragraph (because only one of the two paragraphs would fit on the remaining space on the first page), then both paragraphs shall be rendered on a single page. This property can be chained between multiple paragraphs to ensure that all paragraphs are rendered on a single page without any intervening page boundaries. If this is not possible the entire set of paragraphs that are grouped together using this property would exceed a single page in any case, then the set of "keep with next" paragraphs shall start on a new page, with page breaks as needed afterwards.

If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e. that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then this property shall not be applied.

[Example: Consider the following document with three paragraphs:

DocumentFormat.OpenXml.Wordprocessing.KeepNext-ima

As shown above, the second paragraph and third paragraph are being rendered on two separate pages. However, a producer can specify that the second paragraph should not be displayed without any part of the third by setting the keepNext element as follows:

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

This would ensure that the second paragraph is displayed on the same page as the third paragraph:

DocumentFormat.OpenXml.Wordprocessing.KeepNext-ima

However, if the first paragraph was also set to keepNext, then this set of grouped paragraphs would exceed a page, therefore the set of paragraphs would be grouped and start on the first page, resulting in the second paragraph reappearing on page one:

DocumentFormat.OpenXml.Wordprocessing.KeepNext-ima

Since the paragraphs cannot all be put on one page, they all start on page one and flow as needed. end example]

Parent Elements

pPr (§17.3.1.26); pPr (§17.3.1.25); pPr (§17.7.5.2); pPr (§17.7.6.1); pPr (§17.9.23); pPr (§17.7.8.2)

This element’s content model is defined by the common boolean property definition in §17.17.4.

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

KeepNext Members

DocumentFormat.OpenXml.Wordprocessing Namespace