Keep Next Paragraph, but allow paragraph break

  • When I insert a new paragraph as a "heading" I am trying to set its its properties so that the next paragraph does not become orphaned and g on to the next page. I am using using WPAT_ParKeepN

    to achieve this, which it does. However, the next paragraph is now allowed to split and I cannot find any property to allow the net para to split over the page.

    I am getting this result:

    HEADING

    Next paragraph text

    Next paragraph text

    Next paragraph text

    ---------------------------------------- Page break--------------------------

    Another paragraph text


    I am trying to achieve this:

    HEADING

    Next paragraph text

    ---------------------------------------- Page break--------------------------

    Next paragraph text

    Next paragraph text

    Another paragraph text

    Is this possible?

    • Offizieller Beitrag

    Yes, the meaning is:

    KeepN = keep with next paragraph

    Keep = keep paragraph on page (if possible)

    Code
    var i : Integer;
    WPRichText1.FormatOptions :=   WPRichText1.FormatOptions - [wpfIgnoreKeep, wpfIgnoreKeepN];
    WPRichText1.InputString(#13);
    WPRichText1.ActiveParagraph.ASet(WPAT_ParKeepN, 1);
    WPRichText1.InputString('Heading' + #13 + 'Start ');
    WPRichText1.ActiveParagraph.ASet(WPAT_ParKeep, 1);
    for I := 1 to 100 do WPRichText1.InputString('text ');
    WPRichText1.InputString('end.' + #13);