Getting rid of unwanted line breaks when pasting to OneNote
I got an email this week that asked about a problem I faced years ago. A OneNote user was pasting text into OneNote but the text was formatted poorly. Specifically, there were a lot of carriage return characters inserted into the original content that made the text flow poorly.
What was happening was that the original text had been reformatted with those characters to make the text some fixed width distance. Instead of seeing this after pasting to OneNote:
Four score and seven years ago today, our forefathers brought forth…
He saw this:
Four score and seven
years ago today, our
Changing the outline width in OneNote would do no good. Here's part of the reply I sent him.
I had this same problem when I was importing text files from Project Gutenberg and wrote about it here.
There are two solutions I know that immediately come to mind.
A. Use Word to find and replace the duplicated newline characters at the end of each line.
1. Here is a 1-5 guide. First, on the Home tab click the Paragraph icon to show all characters. In this case for the text you sent me, this showed there was a Paragraph symbol at the end of each line.
2. Click replace
3. Click the More button (labelled “less” in my image, but the name changes after you click it)
4. Then put focus in the Find What field and click Special
5. Choose the character from step 1. In this case it is the Paragraph mark, but I have also seen Manual Line Breaks depending on the original format
6. Then replace that character with a space character otherwise the sentence gets some of its words run together.
B. Write some piece of code to do the same thing. You could write a macro in VBA in Word, use Python (should be pretty simple for this) or any other language you may know. It all boils down to a specialized Find and Replace routine. This is what my addin did, by the way.
The problem with my old addin was that it was tweaked specifically for Project Gutenberg and does not work with HTML formatted text. Word gives this capability, though, so it might be more useful just to use it.
I thought this may help more than one person so I am sharing it here.
Questions, comments, concerns and criticisms always welcome,