KeepWithNext Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
If this property is set to true, the paragraph is displayed on the same page as its following paragraph.
Syntax
public bool KeepWithNext { get; set; }Public Property KeepWithNext As BooleanExamples
The following example applies paragraph layout to selected report text by using ParagraphFormat.KeepWithNext.
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;
paragraphFormat.KeepWithNext = true;
if (paragraphFormat.KeepWithNext)
{
Console.WriteLine("Paragraph Format: Keep With Next is enabled.");
}
textControl.Selection.ParagraphFormat = paragraphFormat;textControl.Text = "First item" & vbCrLf & "Second item" & vbCrLf & "Third item"
textControl.Select(0, textControl.Text.Length)
Dim paragraphFormat As ParagraphFormat = textControl.Selection.ParagraphFormat
paragraphFormat.KeepWithNext = True
If paragraphFormat.KeepWithNext Then
Console.WriteLine("Paragraph Format: Keep With Next is enabled.")
End If
textControl.Selection.ParagraphFormat = paragraphFormatRemarks
The property's default value is false.
The property returns its default value when the text selection contains multiple paragraphs with mixed setting. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.