Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I format Java code in word document [closed]

Tags:

java

I need to write a report which may contain some Java code pieces. I need the code to appear colored and line numbered. How can I do this ?

like image 496
Jury A Avatar asked Aug 11 '12 12:08

Jury A


People also ask

How do I Insert Java code into a word document?

Go to the Insert tab, click the Object drop-down arrow, and pick “Object.” On the Create New tab, select “OpenDocument Text” as the Object Type. Click “OK.” A new Word document will open for you to insert your code or command.

How do I format my Java code?

To format your whole script: Open the required file. Go to Source | Format Document or press Ctrl+Shift+F.


2 Answers

Go to http://hilite.me/ and copy from the preview pane directly to word (tested with MS Word2007). Supports line numbering, but not well. Quite good for snippets.

like image 126
www-0av-Com Avatar answered Oct 05 '22 06:10

www-0av-Com


One way is to copy & paste directly from Eclipse. It preserves all the color formatting.

like image 37
Reimeus Avatar answered Oct 05 '22 07:10

Reimeus