|
|
HOWTO: Removing Carriage Returns (Line Breaks, Form Feeds) from Documents
![]() |
VIPRE Antivirus Premium— the New Release!
|
I answered a question recently about Notepad++, a really nice — and free — text editor that's designed for programmers of any type (but is much better than the regular Notepad for everyone).
The question was "How can I remove formfeeds using Notepad++?"
Tech Tip
If that doesn't make sense, let's use the answer below as an example. A carriage return (an old typewriter term) is the character that tells line (3) below to be on a different line than line (2). Sometimes, we want to remove those characters — or paragraph marks or other non-printing characters that are used for formatting documents.
Of course, you can always go to each one and then hit the Delete key or the Backspace key and remove them one by one. But, the goal was to do it more efficiently.
So, the answer was:
Steps:
1) Using your mouse, highlight a formfeed/carriage return by starting at the end of one line and highlighting to the beginning of the next line.
2) Control-C to copy
3) Control-H to open the Replace dialog box
4) Click in the Find What box
5) Control-V to paste the formfeed/carriage return
6) don't put anything in the Replace With textbox
7) Click on the Replace All button.
That gets them all.
However, that got me thinking about doing the same thing in other editors like Notepad, Wordpad, Microsoft Word and OpenOffice Writer.
With Notepad, the plain text editor that comes as part of Windows, you're out of luck — you can't do this. The "Replace" dialog box does not work with non-printing characters. The only possible option is to take them out one by one.
With Wordpad, the simple word processor that is also included in Windows (as C:\Windows\wordpad.exe or C:\Windows\write.exe), you're similarly also out of luck.
At least Microsoft Word and OpenOffice Writer are consistent here — the Replace dialog box doesn't work for any of them.
Microsoft Word has a better solution than OpenOffice for this function. Word has an Advanced button on its Replace dialog box that looks like the following images. The image on the left is the dialog box and the top of the Special (characters) list. The image on the right is the full Special list.
|
|
This is one thing that, for some reason, OpenOffice Writer has addressed in a very strange way... Perhaps the best way to describe it is by quoting the help file, where I found the following procedure:
Removing Line Breaks Use the AutoFormat feature to remove line breaks that occur within sentences. Unwanted line breaks can occur when you copy text from another source and paste it into a text document.
This AutoFormat feature only works on text that is formatted with the "Default" paragraph style.
1.Choose Tools - AutoCorrect.
2.On the Options tab, ensure that Combine single line paragraphs if length greater than 50% is selected. To change the minimum percentage for the line length, double-click the option in the list, and then enter a new percentage.
3.Click OK.
4.Select the text containing the line breaks that you want to remove.
5.In the Apply Style box on the Formatting bar, choose Default.
6.Choose Format - AutoFormat - Apply.
It actually worked! I assumed that my default installation of OpenOffice 2.2 was set up properly (for this procedure), so I started at the 4th step. It worked just fine. But, this was a very unusual, non-intuitive process.
Winner, among Notepad, Wordpad, Word and Writer: Microsoft Word.
Overall winner: Notepad++
Link to this page — just add this code to your web page!
<a href="http://www.terryscomputertips.com/computers/howto-removing-carriage-returns-from-documents.php">HOWTO: Removing Carriage Returns (Line Breaks, Form Feeds) from Documents</a>
Copyright © 2006-2009 Terry A. Stockdale. All rights reserved.
|
|
Thank you for visiting my site — I hope you found the site and articles helpful. If you did, please consider supporting my efforts by making a purchase (if you have one to make) via one of the links in my articles, one of my recommendations, or in my "Ads by Terry" to purchase the item. You can also shop via these links to major Internet retailers Amazon.com, Buy.com and NewEgg.com, or my Terry's Computer Tips Amazon Store, or the Amazon search box, or shop via my Shopping page...



