How can I format java code in a text document

I need to write a report that may contain some pieces of Java code. I need the code to look colored and number the line. How can i do this?

+6
source share
5 answers

Go to http://hilite.me/ and copy directly to the word from the preview panel (tested with MS Word2007). Supports line numbering, but not very good. Very good for fragments.

+9
source

One way is to copy and paste directly from Eclipse. It saves all color formatting.

+6
source

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

- And before copying the code, make sure that you have the Line Numbering editor turned on in the IDE .

0
source

try using this: http://quickhighlighter.com/

select with line numbers copy and paste

You can also use other online formatting tools (http://stackoverflow.com/questions/206441/online-code-beautifier-and-formatter), but if you want the coloring to work after pasting into a text document, the source hlml source The highline source code must be inline.

0
source
  • You can copy with flowers , but first you have to open all fold , otherwise colors will disappear.

  • Copying line numbering does not work with Eclipse.

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

-1
source

Source: https://habr.com/ru/post/922631/


All Articles