9

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 ?

Marcin
  • 48,559
  • 18
  • 128
  • 201
Jury A
  • 19,192
  • 24
  • 69
  • 93

5 Answers5

13

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.

www-0av-Com
  • 707
  • 10
  • 14
6

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

Reimeus
  • 158,255
  • 15
  • 216
  • 276
1

- Well you can directly copy the things from an IDE to your Word Document.

- And please make sure that you have switched on the Line Numbering of the Editor in the IDE before copying the code.

Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
1

try to use this: http://quickhighlighter.com/

select with the line numbers copy and paste

You can also use another online formatting tools, (http://stackoverflow.com/questions/206441/online-code-beautifier-and-formatter) but if you want the coloring to work after inserting to a word document, the highlihted source code html source must be inline styled.

Kristóf Dombi
  • 3,927
  • 3
  • 18
  • 14
-1
  • You can copy with colors, but first you have to open all fold otherwise colors gone.

  • Line numbering copy is not working from Eclipse.

Explanation with example: https://cmanios.wordpress.com/2012/03/08/copypaste-source-code-from-eclipse-to-microsoft-word/

Daniel Hári
  • 7,254
  • 5
  • 39
  • 54