Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I paste text from Eclipse into Word, it puts each line on its own paragraph. Manually correcting these to line-breaks (shift+enter) is a hassle, is it possible to automate this?

I'm using Word 2008 for Mac if that makes a difference (but would like to know this for other versions of Word too if they differ).

share|improve this question
up vote 13 down vote accepted

You can use the special characters listed in the "More Information" section of this article with the Find and Replace commands on the Edit menu.

You want to replace ^p with ^l (typed literally - the ^ character does not indicate CTRL in this instance), and wildcards must be off for this to work.

To search and replace in just a selection of text rather than the entire document, select the text, bring up the search and replace dialog, and ensure "Current document down" is selected. Now when you click "replace all" it will only search inside the selected text and will prompt you before performing replacements on the rest of the document.

share|improve this answer

Copy a paragraph break and paste in the find textbox. Copy a line break and past in the replace textbox. Click on replace all.

share|improve this answer
Copy pasting this special character does not work in Word 2013. – marcovtwout Mar 18 '14 at 15:31

Alternatively, you might just define a style with no paragraph spacing (and a monospaced font) to use for code.

share|improve this answer
I did this, but Word works a lot better if you work with it rather than fight it. With the code as a single paragraph I only need to set the style on any point for it all to be covered, I can more easily keep code blocks on one page, and I can use tricks like automatically changing to the "Normal" style if I carriage return at the end of a code block. – ZoFreX Aug 11 '11 at 16:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .