Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created November 21, 2023 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/4ffdf79202b8263d864a644ba96c96b5 to your computer and use it in GitHub Desktop.
Save bjoerntx/4ffdf79202b8263d864a644ba96c96b5 to your computer and use it in GitHub Desktop.
private void RemoveAllSections(TextControl textControl)
{
// remove all sections
for (int section = 2; section <= textControl.Sections.Count;)
{
// set the input position to the start of the section
textControl.Select(textControl.Sections[section].Start - 2, 0);
// add a new paragraph
textControl.Selection.Text = "\r\n";
// select the end of paragraph character
textControl.Selection.Length = 1;
// remove the paragraph
textControl.Selection.Text = "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment