Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 7 down vote accepted

http://support.microsoft.com/kb/214204

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
add comment

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 at 15:31
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.