Removing Extra Lines in MS Word

When working on an MS Word document you’ll sometimes find that there are extraneous blank lines between paragraphs getting in the way. This happens frequently when text is pasted in from another source, such as an ASCII file or an e-mail, where it is common practice to hit enter twice between paragraphs (as opposed to indenting the first line of each paragraph). In a Word, however, those extra lines are not only unnecessary, but they are intrusive. The paragraph formatting options in Word allow for refined control of inter-paragraph spacing, paragraph indentation, and so on.

MS_Word_Paragraph_Format.jpg

In the example shown above, we have Word automatically inserting a 6pt spacer above each paragraph plus a 3pt spacer below (for a total of 9pts between paragraphs, which is slightly shorter than a typical text line containing a 10pt font with room for dissenters). The problem is that Word will treat a blank line as an entire paragraph, so we actually end up with about 30pt worth of spacing between paragraphs. Not good.

If there’s only a handful of such blank lines, then it’s no problem to simply place the cursor on each blank line, one at a time, and hit the delete key. But what if these extraneous blank lines go on for 50 pages?

MS_Word_Visible_Marks.jpg

In Word, every paragraph ends with a special paragraph mark, and it turns out that you can perform a search-and-replace on these paragraph marks just as if they were regular text. Normally these paragraph marks are invisible, but you can make them appear by clicking on the button with the paragraph symbol (¶) in the toolbar. Click on the button a second time to render them invisible again. (Note: the paragraph symbols do not need to be visible in order to perform a search and replace against them. I just wanted to show you how to make them visible in case you were curious.)
MS_Word_Special_Paragraphs.jpg
In the search/replace dialog, the notation that refers to a paragraph symbol is ^p (the caret symbol, followed by a lower case P). Don’t worry if you can’t remember this code. Simply click on the More/Less button to expand the dialog box, then click on the special button, and select Paragraph Mark. It will automatically type the ^p for you (into either the Find What, or Replace With, whichever had focus last).

Now, here’s the tricky part. You might think that, in order to delete the blank lines, you’d want to set Find What to ^p, leave Replace With blank, and click the Replace All Button. That will certainly delete the paragraph marks on those blank lines, effectively removing the blank lines, but it will also delete the paragraph marks at the end of the legitimate paragraphs. So, you’d end up with your entire document being one huge paragraph.

Instead, set Find What to ^p^p, and set Replace With to ^p. This tells Word that anywhere it sees two paragraph marks together, with nothing in between them, to replace them with a single paragraph mark — which has the net effect of leaving the first paragraph mark alone while deleting the second one. Note that if your file has multiple blank lines between paragraphs, then you’ll have to click the Replace All button repeatedly to eventually collapse all of the blank lines to nothing.

Now, say instead that the source material did not have blank lines between paragraphs but did indent the first line of each paragraph by five spaces. Here again, those spaces would interfere with the paragraph formatting. To delete those leading spaces, open the search and replace dialog, set Find What to ^p followed by five spaces, and set Replace With to ^p. After clicking on the Replace All button, any paragraph that is followed by another paragraph where the first five characters are spaces, those spaces will be removed. (Note: This counts on you knowing that the paragraphs with leading spaces begin with exactly 5 spaces. If you are unsure of the number of spaces, or if the number varies, then just have this search and replace dialog find ^p followed by a single space (still replacing it with ^p alone). Then, keep clicking on the Replace All button repeatedly until Word reports that it made zero replacements.

Comments

  1. Hi,

    Just found your post. Solved my problem beautifully.

    Thanks.

  2. THANK YOU!!!

  3. This is great! Thx.

  4. Thanks for the useful tip. Helped a lot to me.

  5. Wonderful, wonderful, wonderful - just saved me about an hour (I’d already got bored after 43 deletes before I bothered to look it up!)

  6. Thank you,

    you are an absolute angel. I have been struggling for ages to do this and you solved it for me in a few simple steps.

    Thank you thank you thank you

  7. thanks a lot to you and google :)

  8. Thanks! Very Useful.

  9. Thanks a MILLION!!!! This worked perfectly!

  10. Thanks, Craig. _()_

  11. Thank you!!

  12. Perfect timing! Thanks very much.

  13. You are awesome!!!

  14. Awesome!!! I mean it …

  15. i am very thanks……………Perfect timing! Thanks very much. ………You are awesome!!! ……………..

  16. Wonderful, wonderful, wonderful - just saved me about an hour (I’d already got bored after 43 deletes before I bothered to look it up!)

    i am from Egypt …………………………

  17. Wonderful, wonderful, wonderful - just saved me about an hour (I’d already got bored after 43 deletes before I bothered to look it up!)

    i am from Egypt …………………………

  18. It isn’t uncommon to want to change the formatting of your Word document after you’ve created it. Changing a document’s formatting in word is usually fairly easy. You simply select the text you’d like to change. Then you apply the new formatting.

    But, you can run into complications. For example, you may not have used the formatting options to specify the spacing between paragraphs or lines of text. Instead, you may have inserted extra returns. Do you have to scroll through your document, removing the extra returns manually?

    The process would be tedious. Fortunately, there is an alternative. You can use Word’s Find and Replace feature to remove the extra breaks.

    Follow these steps:

    1. Press Ctrl + H to open the Find and Replace dialog box

    2. In the first box, enter ^p^p (the “p” must be lower case)

    3. In the second box, enter ^p

    4. Click Replace All

    Note: This will replace two paragraph breaks with one. You can specify other options, depending on the number of paragraph breaks you’d like between paragraphs. You can also replace a paragraph break with another character, if you choose.

    If you copied the text from the Internet, this might not work for you. That’s because there are different types of breaks in HTML files. Not to worry, there is a solution:

    5. Press Ctrl + H to open the Find and Replace dialog box

    6. In the first box, enter ^l (the “l” must be lower case)

    7. In the second box, enter ^p

    8. Click Replace All

    You can then replace double breaks as necessary.

  19. Press alt + ┘ (alt+enter)

    that reduces a line breaks too.

  20. This is great stuff! Saved me lots of time. Thanks!

  21. This is great and helpful. Thanks a lot

  22. I spent a lot of time looking and finally your tutorial did the job. Thanks for the detailed explaination.

  23. AWESOME

  24. This is a good start, but I have a scenario in which your method does not work. When the extra (undesired) line appears after a table .Any suggestions?

  25. It didn’t work for me. I found I had to search for ‘^p’ and replace it with nothing. i.e. just delete all the paragraph marks. That worked for me.

  26. I have spent way too many times trying to figure this out!
    You are a life saver!
    Your instructions are easy to follow and worked perfectly!
    THANKS SO MUCH!

  27. I read a lot of interesting articles here. Probably
    you spend a lot of time writing, i know
    how to save you a lot of time, there is an online tool that creates readable, SEO friendly articles in minutes, just search in google - laranitas free content
    source

Post a Comment


Your email is never published nor shared. Required fields are marked *



© 2006-2007 Maxim Software Corp.  All rights reserved.