Remove Paragraph and Line Breaks

Description : Removes paragraph breaks and line breaks on selected paragraphs and merges them into a single paragraph


Remove Paragraph and Line Breaks

You need Onetastic Add-in
for OneNote to run this macro.
Download Onetastic
Author(s) : Omer Atay
Category : Content
Last Updated : May 12, 2018
Requirements : OneNote 2010 or above
Screenshot :

Remove Paragraph and Line Breaks

No screenshot available for this macro.
Changelog :

May 12, 2018 (48D345) - Omer Atay
Updated to handle line breaks as well as paragraph breaks

June 20, 2016 (7EA38C) - Omer Atay
Re-written with the new Macro Language to take advantage of cleaner syntax and performance improvements

These versions are no longer supported:

July 26, 2014 - Omer Atay
Initial version


Omer Atay - 2018-05-12
JS Yeo: They are likely line breaks. I updated the macro to handle line breaks as well. You need to download the latest version of the macro.
JS Yeo - 2018-05-11
This macro not longer seems to work. It seems to pass through the selected text but doesn't seem to have any effect: the lines are still broken in odd places by what are presumably paragraph returns. They can be deleted manually, but the macro doesn't seem to do this any more.
Dan - 2017-01-20
Hello Omer,

I would like to remove the paragraph breaks between SETS of paragraphs that start with

XX1 and end in XX2.

Video provides a powerful way

to help you prove your point.

When you click Online Video,

you can paste in the embed

code for the video you want to add.

I tried for days to do this  - but its not working :(

<?xml version="1.0" encoding="utf-16"?>
<Macro name="Remove Paragraph Breaks" category="Paragraphs" description="" publishDate="00-00-00T00:00:00.000Z" version="15">
  <Comment text="Remove Paragraph Breaks Between  XX1 and XX2" />
  <Expression>$text = ""</Expression>
  <Expression>$FirstParagraph = ""</Expression>
  <ForEach var="Paragraph">
    <Array>QueryObjects("Paragraph", GetCurrentPage())</Array>
      <Condition>$Paragraph.selection == "none"</Condition>
      <Condition>!String_EndsWith($text, "XX2 ", false) &amp;&amp; ($text != "")</Condition>
      <Expression>$text += " "</Expression>
    <Expression>$text += $Paragraph.text</Expression>
    <Expression>$Paragraph.text = ""</Expression>
      <Condition>$FirstParagraph == ""</Condition>
      <Expression>$FirstParagraph = $Paragraph</Expression>
    <Condition>$FirstParagraph != ""</Condition>
    <Expression>$FirstParagraph.text = $text</Expression>

Thank you for any help   - I am really grateful otherwise i have to go through long long document and do this manually  :(