8

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
  • 46,667
  • 17
  • 117
  • 197
Jury A
  • 17,906
  • 24
  • 67
  • 88

5 Answers5

12

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
  • 622
  • 8
  • 13
6

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

Reimeus
  • 155,977
  • 14
  • 207
  • 269
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
  • 32,904
  • 6
  • 47
  • 76
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,787
  • 3
  • 17
  • 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
  • 6,448
  • 5
  • 37
  • 52